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;