diff --git a/packages/backend/src/toeic/dto/patch-quesion.dto.ts b/packages/backend/src/toeic/dto/patch-quesion.dto.ts index c443836..7d2f018 100644 --- a/packages/backend/src/toeic/dto/patch-quesion.dto.ts +++ b/packages/backend/src/toeic/dto/patch-quesion.dto.ts @@ -40,6 +40,8 @@ export class PatchToeicWithQuestion implements ToeicReqBodyProps { @ApiProperty({ description: '토익 문제입니다.', + isArray: true, + type: () => PatchQuestion, }) @IsArray() @ValidateNested({ each: true }) diff --git a/packages/backend/src/toeic/toeic.service.ts b/packages/backend/src/toeic/toeic.service.ts index f38c60d..9356b6e 100644 --- a/packages/backend/src/toeic/toeic.service.ts +++ b/packages/backend/src/toeic/toeic.service.ts @@ -7,10 +7,7 @@ import { PatchQuestionToEntity, ToeicWhereInputProps } from './toeic.interface'; export class ToeicService { constructor(private prisma: PrismaService) {} - async createToeic( - filename: string, - questionInSheet: UploadedQuestionInSheet, - ) { + createToeic(filename: string, questionInSheet: UploadedQuestionInSheet) { return this.prisma.toeic.create({ data: { filename, @@ -22,11 +19,11 @@ export class ToeicService { }); } - async findAllToeic(where: ToeicWhereInputProps) { + findAllToeic(where: ToeicWhereInputProps) { return this.prisma.toeic.findMany({ where }); } - async findToeicUnique(id: number) { + findToeicUnique(id: number) { return this.prisma.toeic.findUniqueOrThrow({ where: { id, @@ -37,7 +34,7 @@ export class ToeicService { }); } - async deleteToeicUnique(id: number) { + deleteToeicUnique(id: number) { return this.prisma.toeic.update({ where: { id, @@ -48,7 +45,7 @@ export class ToeicService { }); } - async updateToeicUnique(id: number, data: PatchQuestionToEntity) { + updateToeicUnique(id: number, data: PatchQuestionToEntity) { return this.prisma.toeic.update({ where: { id, @@ -57,7 +54,7 @@ export class ToeicService { }); } - async findQuestionUnique(uuid: string) { + findQuestionUnique(uuid: string) { return this.prisma.question.findUniqueOrThrow({ where: { id: uuid, diff --git a/packages/backend/src/upload/pipe/workbook.pipe.ts b/packages/backend/src/upload/pipe/workbook.pipe.ts index 2846ee7..f7a36c4 100644 --- a/packages/backend/src/upload/pipe/workbook.pipe.ts +++ b/packages/backend/src/upload/pipe/workbook.pipe.ts @@ -13,7 +13,7 @@ import { QuestionInFile } from '../upload.interface'; export class ParseWorkbookPipe implements PipeTransform> { - private readonly uploadService = new UploadService(); + constructor(private readonly uploadService: UploadService) {} async transform(value: Express.Multer.File) { const workbook = readFile(value.path); diff --git a/packages/backend/src/upload/upload.controller.ts b/packages/backend/src/upload/upload.controller.ts index e6278cd..4a59c7d 100644 --- a/packages/backend/src/upload/upload.controller.ts +++ b/packages/backend/src/upload/upload.controller.ts @@ -35,7 +35,7 @@ export class UploadController { new ParseFilePipe({ validators: [new FileTypeValidator({ fileType: 'sheet' })], }), - new ParseWorkbookPipe(), + ParseWorkbookPipe, ) file: QuestionInFile, ) {