This commit is contained in:
Narul Hidayah
2026-02-11 14:31:15 +07:00
parent 262477a26f
commit 841c08114e
4 changed files with 118 additions and 1 deletions

42
src/entity/department.ts Normal file
View File

@ -0,0 +1,42 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from "typeorm";
import { Status } from "../types/status";
@Entity("departments")
export class Department {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: false,
length: 128,
})
name: string;
@Column({
nullable: false,
length: 64,
})
status: Status;
@Column()
@CreateDateColumn()
created_at: Date;
@Column({ nullable: true, length: 256 })
created_by: string;
@Column({ nullable: true })
@UpdateDateColumn()
updated_at: Date;
@Column({ nullable: true, length: 256 })
updated_by: string;
@Column({ nullable: true })
@DeleteDateColumn()
deleted_at: Date;
@Column({ nullable: true, length: 256 })
deleted_by: string;
}

View File

@ -0,0 +1,68 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm";
import { Status } from "../types/status";
import { Room } from "./room";
@Entity("doctor_schedules")
export class DoctorSchedule {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: false,
length: 32,
})
day: string;
@Column({
nullable: false,
length: 16,
})
start_time: string;
@Column({
nullable: false,
length: 16,
})
end_time: string;
@Column({ type: "uuid", nullable: false })
doctor_id: string;
@ManyToOne(() => Room, { onDelete: "NO ACTION" })
@JoinColumn()
room: Room;
@Column({
nullable: true,
length: 32,
})
quota: string;
@Column({
nullable: false,
length: 64,
})
status: Status;
@Column()
@CreateDateColumn()
created_at: Date;
@Column({ nullable: true, length: 256 })
created_by: string;
@Column({ nullable: true })
@UpdateDateColumn()
updated_at: Date;
@Column({ nullable: true, length: 256 })
updated_by: string;
@Column({ nullable: true })
@DeleteDateColumn()
deleted_at: Date;
@Column({ nullable: true, length: 256 })
deleted_by: string;
}

View File

@ -2,6 +2,7 @@ import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateCol
import { Status } from "../types/status";
import { Poli } from "./poli";
import { Department } from "./department";
import { Service } from "./service";
@Entity("rooms")
@ -27,10 +28,14 @@ export class Room {
})
description: string;
@ManyToOne(() => Poli, { onDelete: "RESTRICT", nullable: false })
@ManyToOne(() => Poli, { onDelete: "RESTRICT", nullable: true })
@JoinColumn()
poli: Poli;
@ManyToOne(() => Department, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
department: Department;
@Column({
nullable: false,
length: 64,

View File

@ -19,6 +19,8 @@ export * from "../entity/service_class"
export * from "../entity/service"
export * from "../entity/service_fare"
export * from "../entity/service_package"
export * from "../entity/department"
export * from "../entity/doctor_schedule"
export * from "../types/action";
export * from "../types/error";