diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index ce2c34e..74074e4 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -85,8 +85,9 @@ export class AuthController { ): Promise { const userId = req.user.id - return await this.commandBus.execute(new UpdateUserCommand(userId, body, files.avatar?.[0])) + return await this.commandBus.execute(new UpdateUserCommand(userId, body, files?.avatar?.[0])) } + @ApiOperation({ description: 'Sign in using email and password. Must have an account to do so.', summary: 'Sign in using email and password. Must have an account to do so.', diff --git a/src/modules/cards/cards.controller.ts b/src/modules/cards/cards.controller.ts index a68b132..324f005 100644 --- a/src/modules/cards/cards.controller.ts +++ b/src/modules/cards/cards.controller.ts @@ -64,7 +64,7 @@ export class CardsController { @Body() body: UpdateCardDto ): Promise { return this.commandBus.execute( - new UpdateCardCommand(id, body, req.user.id, files.answerImg?.[0], files.questionImg?.[0]) + new UpdateCardCommand(id, body, req.user.id, files?.answerImg?.[0], files?.questionImg?.[0]) ) } diff --git a/src/modules/decks/decks.controller.ts b/src/modules/decks/decks.controller.ts index 3ae8de4..ba40bad 100644 --- a/src/modules/decks/decks.controller.ts +++ b/src/modules/decks/decks.controller.ts @@ -123,6 +123,7 @@ export class DecksController { remove(@Param('id') id: string, @Req() req): Promise { return this.commandBus.execute(new DeleteDeckByIdCommand(id, req.user.id)) } + @ApiOperation({ description: 'Retrieve paginated cards in a deck', summary: 'Retrieve cards in a deck', @@ -155,11 +156,12 @@ export class DecksController { @Param('id') id: string, @Req() req, @UploadedFiles() - files: { questionImg: Express.Multer.File[]; answerImg: Express.Multer.File[] }, - @Body() card: CreateCardDto + @Body() + card: CreateCardDto, + files?: { questionImg: Express.Multer.File[]; answerImg: Express.Multer.File[] } ): Promise { return this.commandBus.execute( - new CreateCardCommand(req.user.id, id, card, files.answerImg?.[0], files.questionImg?.[0]) + new CreateCardCommand(req.user.id, id, card, files?.answerImg?.[0], files?.questionImg?.[0]) ) }