From b782c76ccb9bd53952e14f2dc65391e4554467cf Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Fri, 18 Apr 2025 17:53:39 +0700 Subject: [PATCH] update database --- src/entities/Evaluation.ts | 4 ++++ src/entities/Performance.ts | 47 +++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/entities/Performance.ts diff --git a/src/entities/Evaluation.ts b/src/entities/Evaluation.ts index a4b5201..5ad1989 100644 --- a/src/entities/Evaluation.ts +++ b/src/entities/Evaluation.ts @@ -9,6 +9,7 @@ import { Assessment } from "./Assessment"; import { Director } from "./Director"; import { Meeting } from "./Meeting"; import { Portfolio } from "./Portfolio"; +import { Performance } from "./Performance"; @Entity("evaluation") export class Evaluation extends EntityBase { @@ -272,6 +273,9 @@ export class Evaluation extends EntityBase { @OneToMany(() => Portfolio, (portfolio) => portfolio.evaluation) portfolios: Portfolio[]; + @OneToMany(() => Performance, (performance) => performance.evaluation) + performances: Performance[]; + @ManyToMany(() => Director, (director) => director.evaluations) @JoinTable() directors: Director[]; diff --git a/src/entities/Performance.ts b/src/entities/Performance.ts new file mode 100644 index 0000000..f4786a3 --- /dev/null +++ b/src/entities/Performance.ts @@ -0,0 +1,47 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToOne } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Evaluation } from "./Evaluation"; + +@Entity("performance") +export class Performance extends EntityBase { + @Column({ + comment: "Id การทำรายการระบบประเมิน", + length: 40, + default: "00000000-0000-0000-0000-000000000000", + }) + evaluationId: string; + + @Column({ + nullable: true, + comment: "ปีที่ประเมิน", + default: null, + }) + year: number; + + @Column({ + nullable: true, + comment: "ประเภทที่ร้องขอประเมิน", + default: null, + }) + type: string; + + @Column({ + nullable: true, + comment: "ชื่อผลงาน", + default: null, + }) + subject: string; + + @Column({ + nullable: true, + comment: "ผลการประเมิน", + default: null, + }) + evaluationResult: string; + + @ManyToOne(() => Evaluation, (Evaluation) => Evaluation.performances) + @JoinColumn({ name: "evaluationId" }) + evaluation: Evaluation; +} + +export type UpdatePerformance = Partial;