Skip to content

Commit

Permalink
Style: 코드 이름 변경
Browse files Browse the repository at this point in the history
- Swagger에서 nested reqeust body 프로퍼티가 보이게 변경
- 토익 문제 서비스 로직에서 메서드에 불필요한 async 제거
- workbook 파이프에서 upload 서비스를 사용하는 방식 변경

Related to #42
  • Loading branch information
Zamoca42 committed Feb 26, 2024
1 parent 7f16772 commit 7dd63d4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 2 additions & 0 deletions packages/backend/src/toeic/dto/patch-quesion.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export class PatchToeicWithQuestion implements ToeicReqBodyProps {

@ApiProperty({
description: '토익 문제입니다.',
isArray: true,
type: () => PatchQuestion,
})
@IsArray()
@ValidateNested({ each: true })
Expand Down
15 changes: 6 additions & 9 deletions packages/backend/src/toeic/toeic.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -37,7 +34,7 @@ export class ToeicService {
});
}

async deleteToeicUnique(id: number) {
deleteToeicUnique(id: number) {
return this.prisma.toeic.update({
where: {
id,
Expand All @@ -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,
Expand All @@ -57,7 +54,7 @@ export class ToeicService {
});
}

async findQuestionUnique(uuid: string) {
findQuestionUnique(uuid: string) {
return this.prisma.question.findUniqueOrThrow({
where: {
id: uuid,
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/upload/pipe/workbook.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { QuestionInFile } from '../upload.interface';
export class ParseWorkbookPipe
implements PipeTransform<Express.Multer.File, Promise<QuestionInFile>>
{
private readonly uploadService = new UploadService();
constructor(private readonly uploadService: UploadService) {}

async transform(value: Express.Multer.File) {
const workbook = readFile(value.path);
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/upload/upload.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class UploadController {
new ParseFilePipe({
validators: [new FileTypeValidator({ fileType: 'sheet' })],
}),
new ParseWorkbookPipe(),
ParseWorkbookPipe,
)
file: QuestionInFile,
) {
Expand Down

0 comments on commit 7dd63d4

Please sign in to comment.