Skip to content

Commit

Permalink
feat: ✨ projectPreview 에 difficulty 추가
Browse files Browse the repository at this point in the history
- close #326
  • Loading branch information
niamu01 committed Sep 22, 2023
1 parent 1822c4f commit ab5538d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
46 changes: 26 additions & 20 deletions app/src/api/project/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ export class ProjectService {
async findOneProjectPreviewAndLean(
queryArgs?: Omit<QueryArgs<project>, 'select'>,
): Promise<ProjectPreview | null> {
const project: Pick<project, 'id' | 'name' | 'circle' | 'pdfUrl'> | 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
? {
Expand All @@ -53,16 +56,19 @@ export class ProjectService {
async findAllProjectPreviewAndLean(
queryArgs?: Omit<QueryArgs<project>, 'select'>,
): Promise<ProjectPreview[]> {
const projects: Pick<project, 'id' | 'name' | 'circle' | 'pdfUrl'>[] =
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,
Expand Down
3 changes: 3 additions & 0 deletions app/src/common/models/common.project.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ export class ProjectPreview implements Pick<project, 'id' | 'name'> {

@Field({ nullable: true })
pdfUrl?: string;

@Field({ nullable: true })
difficulty?: number;
}
1 change: 1 addition & 0 deletions app/src/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type ProjectPreview {
url: String!
circle: Int
pdfUrl: String
difficulty: Int
}

type Coalition {
Expand Down

0 comments on commit ab5538d

Please sign in to comment.