From 7e7a432d358459d1cca0fdda3f85c97cbf2a2e1d Mon Sep 17 00:00:00 2001 From: Yechan Lee Date: Tue, 27 Feb 2024 23:29:16 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20submission-language=20entity=20=EA=B0=84?= =?UTF-8?q?=20=EA=B4=80=EA=B3=84=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/competition/entities/competition.entity.ts | 7 +++---- .../src/competition/entities/submission.entity.ts | 10 ++++++++-- .../src/problem/entities/language.entity.ts | 4 ++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/be/algo-with-me-api/src/competition/entities/competition.entity.ts b/be/algo-with-me-api/src/competition/entities/competition.entity.ts index 44c18b4..3914c9a 100644 --- a/be/algo-with-me-api/src/competition/entities/competition.entity.ts +++ b/be/algo-with-me-api/src/competition/entities/competition.entity.ts @@ -9,11 +9,10 @@ import { } from 'typeorm'; import { CompetitionParticipant } from './competition.participant.entity'; -import { CompetitionProblem } from '../../problem/entities/competition.problem.entity'; import { Submission } from './submission.entity'; - -import { Dashboard } from '@src/dashboard/entities/dashboard.entity'; -import { User } from '@src/user/entities/user.entity'; +import { Dashboard } from '../../dashboard/entities/dashboard.entity'; +import { CompetitionProblem } from '../../problem/entities/competition.problem.entity'; +import { User } from '../../user/entities/user.entity'; @Entity() export class Competition { diff --git a/be/algo-with-me-api/src/competition/entities/submission.entity.ts b/be/algo-with-me-api/src/competition/entities/submission.entity.ts index b9b7627..e5f44a4 100644 --- a/be/algo-with-me-api/src/competition/entities/submission.entity.ts +++ b/be/algo-with-me-api/src/competition/entities/submission.entity.ts @@ -8,11 +8,11 @@ import { } from 'typeorm'; import { Competition } from './competition.entity'; +import { Language } from '../../problem/entities/language.entity'; import { Problem } from '../../problem/entities/problem.entity'; +import { User } from '../../user/entities/user.entity'; import { RESULT } from '../competition.enums'; -import { User } from '@src/user/entities/user.entity'; - @Entity() export class Submission { @PrimaryGeneratedColumn() @@ -49,6 +49,12 @@ export class Submission { @ManyToOne(() => User, (user) => user.submissions, { nullable: false }) user: User; + @Column() + languageId: number; + + @ManyToOne(() => Language, (language) => language.submissions, { nullable: false }) + language: Language; + @CreateDateColumn() createdAt: Date; diff --git a/be/algo-with-me-api/src/problem/entities/language.entity.ts b/be/algo-with-me-api/src/problem/entities/language.entity.ts index aa7df9d..9f6dc2e 100644 --- a/be/algo-with-me-api/src/problem/entities/language.entity.ts +++ b/be/algo-with-me-api/src/problem/entities/language.entity.ts @@ -8,6 +8,7 @@ import { } from 'typeorm'; import { ProblemLanguage } from './problem.language.entity'; +import { Submission } from '../../competition/entities/submission.entity'; @Entity() export class Language { @@ -20,6 +21,9 @@ export class Language { @OneToMany(() => ProblemLanguage, (ProblemLanguage) => ProblemLanguage.problem) problemLanguages: ProblemLanguage[]; + @OneToMany(() => Submission, (submission) => submission.problem) + submissions: Submission[]; + @CreateDateColumn() createdAt: Date;