members-database/entities/member_awards.ts
2024-08-19 12:47:10 +02:00

32 lines
770 B
TypeScript

import { Column, Entity, ManyToOne, PrimaryColumn, Unique } from "typeorm";
import { member } from "./member";
import { award } from "./award";
@Entity()
@Unique(["memberId", "awardId"])
export class member_awards {
@PrimaryColumn({ type: "varchar", length: 36 })
memberId: string;
@PrimaryColumn({ type: "varchar", length: 36 })
awardId: string;
@Column({ type: "boolean", default: true })
given: boolean;
@Column({ type: "varchar", length: 255, nullable: true, default: null })
reason?: string;
@Column({ type: "date" })
date: Date;
@ManyToOne(() => member, (member) => member.awards, {
onDelete: "RESTRICT",
})
member: member;
@ManyToOne(() => award, (award) => award.members, {
onDelete: "RESTRICT",
})
award: award;
}