From ab5538d8847bad8e68150a1b4c84cf108fbd31fe Mon Sep 17 00:00:00 2001 From: niamu01 Date: Sun, 17 Sep 2023 18:45:15 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20:sparkles:=20projectPreview=20=EC=97=90?= =?UTF-8?q?=20difficulty=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - close #326 --- app/src/api/project/project.service.ts | 46 +++++++++++-------- app/src/common/models/common.project.model.ts | 3 ++ app/src/schema.gql | 1 + 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/app/src/api/project/project.service.ts b/app/src/api/project/project.service.ts index c36f7996..0589cac2 100644 --- a/app/src/api/project/project.service.ts +++ b/app/src/api/project/project.service.ts @@ -31,16 +31,19 @@ export class ProjectService { async findOneProjectPreviewAndLean( queryArgs?: Omit, 'select'>, ): Promise { - const project: Pick | null = - await this.findOneAndLean({ - ...queryArgs, - select: { - id: 1, - name: 1, - circle: 1, - pdfUrl: 1, - }, - }); + const project: Pick< + project, + 'id' | 'name' | 'circle' | 'pdfUrl' | 'difficulty' + > | null = await this.findOneAndLean({ + ...queryArgs, + select: { + id: 1, + name: 1, + circle: 1, + pdfUrl: 1, + difficulty: 1, + }, + }); return project ? { @@ -53,16 +56,19 @@ export class ProjectService { async findAllProjectPreviewAndLean( queryArgs?: Omit, 'select'>, ): Promise { - const projects: Pick[] = - await this.findAllAndLean({ - ...queryArgs, - select: { - id: 1, - name: 1, - circle: 1, - pdfUrl: 1, - }, - }); + const projects: Pick< + project, + 'id' | 'name' | 'circle' | 'pdfUrl' | 'difficulty' + >[] = await this.findAllAndLean({ + ...queryArgs, + select: { + id: 1, + name: 1, + circle: 1, + pdfUrl: 1, + difficulty: 1, + }, + }); return projects.map((project) => ({ ...project, diff --git a/app/src/common/models/common.project.model.ts b/app/src/common/models/common.project.model.ts index 5b45e01c..a10009ce 100644 --- a/app/src/common/models/common.project.model.ts +++ b/app/src/common/models/common.project.model.ts @@ -17,4 +17,7 @@ export class ProjectPreview implements Pick { @Field({ nullable: true }) pdfUrl?: string; + + @Field({ nullable: true }) + difficulty?: number; } diff --git a/app/src/schema.gql b/app/src/schema.gql index 634045d4..732df3ad 100644 --- a/app/src/schema.gql +++ b/app/src/schema.gql @@ -37,6 +37,7 @@ type ProjectPreview { url: String! circle: Int pdfUrl: String + difficulty: Int } type Coalition {