-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(be): merge client problem repository into service
- Loading branch information
Showing
8 changed files
with
589 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
apps/backend/apps/client/src/problem/dto/code-draft.response.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import type { CreateTemplateDto } from './create-code-draft.dto' | ||
import type { JsonValue } from '@prisma/client/runtime/library' | ||
|
||
export class CodeDraftResponseDto { | ||
userId: string | ||
problemId: string | ||
template: CreateTemplateDto | ||
createTime: string | ||
updateTime: string | ||
userId: number | ||
problemId: number | ||
template: JsonValue | ||
createTime: Date | ||
updateTime: Date | ||
} |
80 changes: 50 additions & 30 deletions
80
apps/backend/apps/client/src/problem/dto/problem.response.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,53 @@ | ||
import { | ||
type Language, | ||
Level, | ||
type ProblemTestcase, | ||
type Tag | ||
} from '@prisma/client' | ||
import { Exclude, Expose } from 'class-transformer' | ||
import type { Language, Level, ProblemTestcase, Tag } from '@prisma/client' | ||
import type { JsonValue } from '@prisma/client/runtime/library' | ||
|
||
@Exclude() | ||
export class ProblemResponseDto { | ||
@Expose() id: number | ||
@Expose() title: string | ||
@Expose() description: string | ||
@Expose() inputDescription: string | ||
@Expose() outputDescription: string | ||
@Expose() hint: string | ||
@Expose() engTitle: string | ||
@Expose() engDescription: string | ||
@Expose() engInputDescription: string | ||
@Expose() engOutputDescription: string | ||
@Expose() engHint: string | ||
@Expose() languages: Language[] | ||
@Expose() timeLimit: number | ||
@Expose() memoryLimit: number | ||
@Expose() difficulty: Level | ||
@Expose() source: string[] | ||
@Expose() submissionCount: number | ||
@Expose() acceptedCount: number | ||
@Expose() acceptedRate: number | ||
@Expose() tags: Partial<Tag>[] | ||
@Expose() template: JSON[] | ||
@Expose() problemTestcase: Pick<ProblemTestcase, 'id' | 'input' | 'output'>[] | ||
id: number | ||
title: string | ||
description: string | ||
inputDescription: string | ||
outputDescription: string | ||
hint: string | ||
engTitle: string | null | ||
engDescription: string | null | ||
engInputDescription: string | null | ||
engOutputDescription: string | null | ||
engHint: string | null | ||
languages: Language[] | ||
timeLimit: number | ||
memoryLimit: number | ||
difficulty: Level | ||
source: string | ||
submissionCount: number | ||
acceptedCount: number | ||
acceptedRate: number | ||
tags: Partial<Tag>[] | ||
template: JsonValue[] | ||
problemTestcase: Pick<ProblemTestcase, 'id' | 'input' | 'output'>[] | ||
} | ||
|
||
// @Exclude() | ||
// export class ProblemResponseDto { | ||
// @Expose() id: number | ||
// @Expose() title: string | ||
// @Expose() description: string | ||
// @Expose() inputDescription: string | ||
// @Expose() outputDescription: string | ||
// @Expose() hint: string | ||
// @Expose() engTitle: string | ||
// @Expose() engDescription: string | ||
// @Expose() engInputDescription: string | ||
// @Expose() engOutputDescription: string | ||
// @Expose() engHint: string | ||
// @Expose() languages: Language[] | ||
// @Expose() timeLimit: number | ||
// @Expose() memoryLimit: number | ||
// @Expose() difficulty: Level | ||
// @Expose() source: string[] | ||
// @Expose() submissionCount: number | ||
// @Expose() acceptedCount: number | ||
// @Expose() acceptedRate: number | ||
// @Expose() tags: Partial<Tag>[] | ||
// @Expose() template: JSON[] | ||
// @Expose() problemTestcase: Pick<ProblemTestcase, 'id' | 'input' | 'output'>[] | ||
// } |
28 changes: 2 additions & 26 deletions
28
apps/backend/apps/client/src/problem/dto/problems.response.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,18 @@ | ||
import { Level, type Language, type Tag } from '@prisma/client' | ||
import { Exclude, Expose, Type } from 'class-transformer' | ||
import type { Language, Level, Tag } from '@prisma/client' | ||
|
||
@Exclude() | ||
export class ProblemsResponseDto { | ||
@Expose() | ||
@Type(() => Problem) | ||
data: Problem[] | ||
|
||
@Expose() | ||
total: number | ||
} | ||
|
||
@Exclude() | ||
class Problem { | ||
@Expose() | ||
id: number | ||
|
||
@Expose() | ||
title: string | ||
|
||
@Expose() | ||
engTitle: string | ||
|
||
@Expose() | ||
engTitle: string | null | ||
difficulty: Level | ||
|
||
@Expose() | ||
submissionCount: number | ||
|
||
@Expose() | ||
acceptedRate: number | ||
|
||
@Expose() | ||
tags: Partial<Tag>[] | ||
|
||
@Expose() | ||
languages: Language[] | ||
|
||
@Expose() | ||
hasPassed: boolean | null | ||
} |
11 changes: 2 additions & 9 deletions
11
apps/backend/apps/client/src/problem/dto/related-problem.response.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,6 @@ | ||
import { Problem } from '@prisma/client' | ||
import { Exclude, Expose, Type } from 'class-transformer' | ||
import { ProblemResponseDto } from './problem.response.dto' | ||
import type { ProblemResponseDto } from './problem.response.dto' | ||
|
||
@Exclude() | ||
export class RelatedProblemResponseDto { | ||
@Expose() | ||
order: number | ||
|
||
@Expose() | ||
@Type(() => ProblemResponseDto) | ||
problem: Problem | ||
problem: ProblemResponseDto | ||
} |
85 changes: 50 additions & 35 deletions
85
apps/backend/apps/client/src/problem/dto/related-problems.response.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,66 @@ | ||
import { Level } from '@prisma/client' | ||
import { Exclude, Expose, Transform, Type } from 'class-transformer' | ||
import { IsOptional } from 'class-validator' | ||
import type { Level } from '@prisma/client' | ||
|
||
@Exclude() | ||
export class RelatedProblemsResponseDto { | ||
@Expose() | ||
@Type(() => Problem) | ||
data: Problem[] | ||
|
||
@Expose() | ||
total: number | ||
} | ||
|
||
@Exclude() | ||
// @Exclude() | ||
// export class RelatedProblemsResponseDto { | ||
// @Expose() | ||
// @Type(() => Problem) | ||
// data: Problem[] | ||
|
||
// @Expose() | ||
// total: number | ||
// } | ||
|
||
class Problem { | ||
@Expose() | ||
order: number | ||
|
||
@Expose() | ||
@Transform(({ obj }) => obj.problem.id, { toClassOnly: true }) | ||
id: number | ||
|
||
@Expose() | ||
@Transform(({ obj }) => obj.problem.title, { toClassOnly: true }) | ||
title: number | ||
|
||
@Expose() | ||
@Transform(({ obj }) => obj.problem.difficulty, { toClassOnly: true }) | ||
title: string | ||
difficulty: Level | ||
|
||
@Expose() | ||
@Transform(({ obj }) => obj.problem.submissionCount, { toClassOnly: true }) | ||
submissionCount: number | ||
|
||
@Expose() | ||
@Transform(({ obj }) => obj.problem.acceptedRate, { toClassOnly: true }) | ||
acceptedRate: number | ||
|
||
@Expose() | ||
@IsOptional() | ||
maxScore: number | null | ||
|
||
@Expose() | ||
@IsOptional() | ||
score: string | null | ||
|
||
@Expose() | ||
@IsOptional() | ||
submissionTime: Date | null | ||
} | ||
|
||
// @Exclude() | ||
// class Problem { | ||
// @Expose() | ||
// order: number | ||
|
||
// @Expose() | ||
// @Transform(({ obj }) => obj.problem.id, { toClassOnly: true }) | ||
// id: number | ||
|
||
// @Expose() | ||
// @Transform(({ obj }) => obj.problem.title, { toClassOnly: true }) | ||
// title: number | ||
|
||
// @Expose() | ||
// @Transform(({ obj }) => obj.problem.difficulty, { toClassOnly: true }) | ||
// difficulty: Level | ||
|
||
// @Expose() | ||
// @Transform(({ obj }) => obj.problem.submissionCount, { toClassOnly: true }) | ||
// submissionCount: number | ||
|
||
// @Expose() | ||
// @Transform(({ obj }) => obj.problem.acceptedRate, { toClassOnly: true }) | ||
// acceptedRate: number | ||
|
||
// @Expose() | ||
// @IsOptional() | ||
// maxScore: number | null | ||
|
||
// @Expose() | ||
// @IsOptional() | ||
// score: string | null | ||
|
||
// @Expose() | ||
// @IsOptional() | ||
// submissionTime: Date | null | ||
// } |
Oops, something went wrong.