Move software files one directory up, Readme
This commit is contained in:
33
backend/models/exercises/exercise.model.ts
Normal file
33
backend/models/exercises/exercise.model.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { BelongsTo, Column, ForeignKey, Model, Table } from "sequelize-typescript";
|
||||
import { ExerciseGroup } from "./exerciseGroup.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Exercise extends Model {
|
||||
@Column
|
||||
nameDe: string
|
||||
|
||||
@Column
|
||||
nameEn: string
|
||||
|
||||
@Column
|
||||
exerciseNr: number
|
||||
|
||||
@Column
|
||||
descriptionDe: string
|
||||
|
||||
@Column
|
||||
descriptionEn: string
|
||||
|
||||
@Column
|
||||
solved: boolean
|
||||
|
||||
@ForeignKey(() => ExerciseGroup)
|
||||
@Column
|
||||
exerciseGroupId: number
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => ExerciseGroup)
|
||||
exerciseGroup: ExerciseGroup
|
||||
}
|
||||
26
backend/models/exercises/exerciseGroup.model.ts
Normal file
26
backend/models/exercises/exerciseGroup.model.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Column, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Exercise } from "./exercise.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class ExerciseGroup extends Model {
|
||||
@Column
|
||||
nameDe: string
|
||||
|
||||
@Column
|
||||
nameEn: string
|
||||
|
||||
@Column
|
||||
groupNr: number
|
||||
|
||||
@Column
|
||||
descriptionDe: string
|
||||
|
||||
@Column
|
||||
descriptionEn: string
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@HasMany(() => Exercise)
|
||||
exercises: Exercise[]
|
||||
}
|
||||
Reference in New Issue
Block a user