From 2087594aefca1a3b3608bd7d0d7d3a70807cc925 Mon Sep 17 00:00:00 2001 From: Narul Hidayah Date: Thu, 5 Feb 2026 13:57:26 +0700 Subject: [PATCH] poli, room --- src/entity/poli.ts | 39 ++++++++++++++++++++++++++++++ src/entity/room.ts | 56 ++++++++++++++++++++++++++++++++++++++++++++ src/schema/public.ts | 2 ++ 3 files changed, 97 insertions(+) create mode 100644 src/entity/poli.ts create mode 100644 src/entity/room.ts diff --git a/src/entity/poli.ts b/src/entity/poli.ts new file mode 100644 index 0000000..b288adf --- /dev/null +++ b/src/entity/poli.ts @@ -0,0 +1,39 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from "typeorm"; + +import { Status } from "../types/status"; + +@Entity("polis") +export class Poli { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + length: 256, + }) + poli: string; + + @Column({ + nullable: false, + length: 64, + }) + status: Status; + + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true, length: 256 }) + created_by: string; + + @UpdateDateColumn({ nullable: true }) + updated_at: Date; + + @Column({ nullable: true, length: 256 }) + updated_by: string; + + @DeleteDateColumn({ nullable: true }) + deleted_at: Date; + + @Column({ nullable: true, length: 256 }) + deleted_by: string; +} diff --git a/src/entity/room.ts b/src/entity/room.ts new file mode 100644 index 0000000..2a7f10a --- /dev/null +++ b/src/entity/room.ts @@ -0,0 +1,56 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm"; + +import { Status } from "../types/status"; +import { Poli } from "./poli"; + +@Entity("rooms") +export class Room { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + length: 256, + }) + room: string; + + @Column({ + nullable: false, + length: 128, + }) + code: string; + + @Column({ + nullable: true, + length: 512, + }) + description: string; + + @ManyToOne(() => Poli, { onDelete: "RESTRICT", nullable: false }) + @JoinColumn() + poli: Poli; + + @Column({ + nullable: false, + length: 64, + }) + status: Status; + + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true, length: 256 }) + created_by: string; + + @UpdateDateColumn({ nullable: true }) + updated_at: Date; + + @Column({ nullable: true, length: 256 }) + updated_by: string; + + @DeleteDateColumn({ nullable: true }) + deleted_at: Date; + + @Column({ nullable: true, length: 256 }) + deleted_by: string; +} diff --git a/src/schema/public.ts b/src/schema/public.ts index db50ef8..0033ed8 100644 --- a/src/schema/public.ts +++ b/src/schema/public.ts @@ -12,6 +12,8 @@ export * from "../entity/application" export * from "../entity/nationality" export * from "../entity/diagnosis" export * from "../entity/diagnostic_procedure" +export * from "../entity/poli" +export * from "../entity/room" export * from "../types/action"; export * from "../types/error";