29 lines
580 B
TypeScript
29 lines
580 B
TypeScript
import {
|
|
Collection,
|
|
Entity,
|
|
ManyToMany,
|
|
PrimaryKey,
|
|
Property,
|
|
} from '@mikro-orm/core';
|
|
import { v4 } from 'uuid';
|
|
import { Teacher } from '../users/teacher.entity.js';
|
|
import { Student } from '../users/student.entity.js';
|
|
|
|
@Entity({
|
|
repository: () => {
|
|
return ClassRepository;
|
|
},
|
|
})
|
|
export class Class {
|
|
@PrimaryKey()
|
|
classId? = v4();
|
|
|
|
@Property({ type: 'string' })
|
|
displayName!: string;
|
|
|
|
@ManyToMany(() => Teacher)
|
|
teachers!: Collection<Teacher>;
|
|
|
|
@ManyToMany(() => Student)
|
|
students!: Collection<Student>;
|
|
}
|