From b00bd0856526f856e6c753564e166cc9bbca2da2 Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Mon, 30 Mar 2026 09:40:20 +0700 Subject: [PATCH] update: patient_guarantor.ts add faretype relation and update swagger builder --- src/entity/patient_guarantor.ts | 151 +++++++++++++++++--------------- 1 file changed, 78 insertions(+), 73 deletions(-) diff --git a/src/entity/patient_guarantor.ts b/src/entity/patient_guarantor.ts index be9ef9c..24c3fe6 100644 --- a/src/entity/patient_guarantor.ts +++ b/src/entity/patient_guarantor.ts @@ -1,74 +1,79 @@ import { - Entity, - PrimaryGeneratedColumn, - Column, - ManyToOne, - JoinColumn, - CreateDateColumn, - UpdateDateColumn, - DeleteDateColumn, - } from "typeorm"; - import { PatientGroup } from "./patient_group"; // Import entity PatientGroup - - @Entity("patient_guarantor") - export class PatientGuarantor { - @PrimaryGeneratedColumn("uuid") - id!: string; - - // Nama penjamin pasien - @Column({ type: "text", nullable: false }) - guarantor_name!: string; - - // Nomor telepon penjamin pasien - @Column({ type: "text", nullable: false }) - phone!: string; - - // Provinsi tempat tinggal penjamin pasien - @Column({ type: "text", nullable: false }) - province!: string; - - // Kota tempat tinggal penjamin pasien - @Column({ type: "text", nullable: false }) - city!: string; - - // Kode pos tempat tinggal penjamin pasien - @Column({ type: "text", nullable: false }) - zip_code!: string; - - // Nomor perjanjian atau kontrak - @Column({ type: "text", nullable: false }) - agreement_no!: string; - - // Deskripsi perjanjian atau kontrak - @Column({ type: "text", nullable: true }) - agreement_desc?: string; - - // Relasi ke PatientGroup, setiap penjamin dapat terhubung dengan satu grup pasien - @ManyToOne(() => PatientGroup, { nullable: false }) - @JoinColumn({ name: "patient_group_id" }) - patient_group!: PatientGroup; - - // Tanggal pembuatan - @CreateDateColumn() - created_at!: Date; - - // Kolom untuk tracking siapa yang membuat - @Column({ nullable: true, length: 256 }) - created_by?: string; - - // Tanggal pembaruan - @UpdateDateColumn({ nullable: true }) - updated_at?: Date; - - // Kolom untuk tracking siapa yang memperbarui - @Column({ nullable: true, length: 256 }) - updated_by?: string; - - // Tanggal penghapusan - @DeleteDateColumn({ nullable: true }) - deleted_at?: Date; - - // Kolom untuk tracking siapa yang menghapus - @Column({ nullable: true, length: 256 }) - deleted_by?: string; - } \ No newline at end of file + Entity, + PrimaryGeneratedColumn, + Column, + ManyToOne, + JoinColumn, + CreateDateColumn, + UpdateDateColumn, + DeleteDateColumn, +} from "typeorm"; +import { PatientGroup } from "./patient_group"; // Import entity PatientGroup +import { FareType } from "./faretype"; + +@Entity("patient_guarantor") +export class PatientGuarantor { + @PrimaryGeneratedColumn("uuid") + id!: string; + + // Nama penjamin pasien + @Column({ type: "text", nullable: false }) + guarantor_name!: string; + + // Nomor telepon penjamin pasien + @Column({ type: "text", nullable: false }) + phone!: string; + + // Provinsi tempat tinggal penjamin pasien + @Column({ type: "text", nullable: false }) + province!: string; + + // Kota tempat tinggal penjamin pasien + @Column({ type: "text", nullable: false }) + city!: string; + + // Kode pos tempat tinggal penjamin pasien + @Column({ type: "text", nullable: false }) + zip_code!: string; + + // Nomor perjanjian atau kontrak + @Column({ type: "text", nullable: false }) + agreement_no!: string; + + // Deskripsi perjanjian atau kontrak + @Column({ type: "text", nullable: true }) + agreement_desc?: string; + + // Relasi ke PatientGroup, setiap penjamin dapat terhubung dengan satu grup pasien + @ManyToOne(() => PatientGroup, { nullable: false }) + @JoinColumn({ name: "patient_group_id" }) + patient_group!: PatientGroup; + + @ManyToOne(() => FareType, { nullable: false }) + @JoinColumn() + faretype!: FareType; + + // Tanggal pembuatan + @CreateDateColumn() + created_at!: Date; + + // Kolom untuk tracking siapa yang membuat + @Column({ nullable: true, length: 256 }) + created_by?: string; + + // Tanggal pembaruan + @UpdateDateColumn({ nullable: true }) + updated_at?: Date; + + // Kolom untuk tracking siapa yang memperbarui + @Column({ nullable: true, length: 256 }) + updated_by?: string; + + // Tanggal penghapusan + @DeleteDateColumn({ nullable: true }) + deleted_at?: Date; + + // Kolom untuk tracking siapa yang menghapus + @Column({ nullable: true, length: 256 }) + deleted_by?: string; +} \ No newline at end of file