add file upload service

This commit is contained in:
andres
2023-07-16 13:55:05 +02:00
parent df1f041961
commit cde1d9fd02
8 changed files with 547 additions and 17 deletions

View File

@@ -13,7 +13,7 @@ import {
import { CardsService } from './cards.service'
import { UpdateCardDto } from './dto/update-card.dto'
import { CommandBus } from '@nestjs/cqrs'
import { DeleteCardByIdCommand, GetDeckByIdCommand } from './use-cases'
import { DeleteCardByIdCommand, GetDeckByIdCommand, UpdateCardCommand } from './use-cases'
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard'
import { FileFieldsInterceptor } from '@nestjs/platform-express'
@@ -44,7 +44,9 @@ export class CardsController {
) {
console.log({ body })
console.log(files)
// return this.commandBus.execute(new UpdateCardCommand(id, body, req.user.id))
return this.commandBus.execute(
new UpdateCardCommand(id, body, req.user.id, files.answerImg[0], files.questionImg[0])
)
}
@UseGuards(JwtAuthGuard)