From 9527a9a021215ce5a271d5328b48660b06fa2378 Mon Sep 17 00:00:00 2001 From: fro1991 Date: Wed, 5 Nov 2025 12:46:45 +0700 Subject: [PATCH] update --- src/entity/trx_maintenance_details.ts | 69 ++++++++++++++++++++++++ src/entity/trx_maintenance_slas.ts | 71 ++++++++++++++++++++++++ src/entity/trx_maintenances.ts | 78 +++++++++++++++++++++++++++ src/schema/trx.ts | 3 ++ src/types/trx.ts | 29 ++++++++++ 5 files changed, 250 insertions(+) create mode 100644 src/entity/trx_maintenance_details.ts create mode 100644 src/entity/trx_maintenance_slas.ts create mode 100644 src/entity/trx_maintenances.ts diff --git a/src/entity/trx_maintenance_details.ts b/src/entity/trx_maintenance_details.ts new file mode 100644 index 0000000..28b0754 --- /dev/null +++ b/src/entity/trx_maintenance_details.ts @@ -0,0 +1,69 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { TrxMaintenanceActionType, TrxMaintenancePosition, TrxMaintenanceStatus } from "../types/trx"; +import { TrxMaintenance } from "./trx_maintenances"; +import { text } from "stream/consumers"; + +@Entity("trx_maintenance_details", { schema: "trx" }) +export class trxMaintenanceDetail { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => TrxMaintenance, { onDelete: "NO ACTION" }) + @JoinColumn() + maintenance: TrxMaintenance; + + @Column({ + length: 256, + }) + action_type: TrxMaintenanceActionType; + + @Column({ + length: 256, + }) + reference_table: String; + + @Column({ + length: 256, + }) + reference_column: String; + + @Column({ + nullable: true, + length: 256, + type: "uuid", + }) + reference_id: String; + + @Column({ + nullable: true, + type: "text", + }) + value_old: String; + + @Column({ + nullable: true, + type: "text", + }) + value_new: String; + + @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; +} diff --git a/src/entity/trx_maintenance_slas.ts b/src/entity/trx_maintenance_slas.ts new file mode 100644 index 0000000..40b45ad --- /dev/null +++ b/src/entity/trx_maintenance_slas.ts @@ -0,0 +1,71 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { TrxMaintenancePosition, TrxMaintenanceStatus } from "../types/trx"; +import { TrxMaintenance } from "./trx_maintenances"; + +@Entity("trx_maintenance_slas", { schema: "trx" }) +export class trxMaintenanceSla { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => TrxMaintenance, { onDelete: "NO ACTION" }) + @JoinColumn() + maintenance: TrxMaintenance; + + @Column({ + length: 256, + }) + position: TrxMaintenancePosition; + + @Column({ + length: 256, + }) + status: TrxMaintenanceStatus; + + @Column({ + length: 256, + }) + start_by: string; + + @Column({ + nullable: true, + }) + start_at: Date; + + @Column({ + length: 256, + nullable: true, + }) + end_by: string; + + @Column({ + nullable: true, + }) + end_at: Date; + + @Column({ + nullable: true, + type: "float8", + }) + duration: number; + + @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; +} diff --git a/src/entity/trx_maintenances.ts b/src/entity/trx_maintenances.ts new file mode 100644 index 0000000..78151a1 --- /dev/null +++ b/src/entity/trx_maintenances.ts @@ -0,0 +1,78 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; + +import { TrxMaintenancePosition, TrxMaintenanceRemark, TrxMaintenanceStatus, TrxMaintenanceType } from "../types/trx"; +import { TrxCustomer } from "./trx_customers"; + +@Entity("trx_maintenances", { schema: "trx" }) +export class TrxMaintenance { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + unique: true, + length: 64, + }) + code: string; + + @ManyToOne(() => TrxCustomer, { onDelete: "RESTRICT" }) + @JoinTable() + customer: TrxCustomer; + + @Column({ + nullable: false, + length: 64, + }) + type: TrxMaintenanceType; + + @Column({ + nullable: false, + length: 4096, + }) + reason: string; + + @Column({ + nullable: true, + length: 256, + }) + file: string; + + @Column({ + nullable: false, + length: 64, + }) + position: TrxMaintenancePosition; + + @Column({ + nullable: false, + length: 64, + }) + status: TrxMaintenanceStatus; + + @Column({ + nullable: false, + length: 64, + }) + remark: TrxMaintenanceRemark; + + @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; +} diff --git a/src/schema/trx.ts b/src/schema/trx.ts index 2552827..4b814a5 100644 --- a/src/schema/trx.ts +++ b/src/schema/trx.ts @@ -21,4 +21,7 @@ export * from "../entity/trx_transaction_slas"; export * from "../entity/trx_transaction_amls"; export * from "../entity/trx_transaction_signatures"; export * from "../entity/trx_email_logs"; +export * from "../entity/trx_maintenances"; +export * from "../entity/trx_maintenance_details"; +export * from "../entity/trx_maintenance_slas"; export * from "../types/trx"; diff --git a/src/types/trx.ts b/src/types/trx.ts index 4c5cdbf..da28f79 100644 --- a/src/types/trx.ts +++ b/src/types/trx.ts @@ -100,4 +100,33 @@ export enum TrxMaintenanceType { "business" = "business", } +export enum TrxMaintenancePosition { + "cs" = "cs", + "supervisor" = "supervisor", + "manager" = "manager", + "customer" = "customer", +} + +export enum TrxMaintenanceStatus { + "submit" = "submit", + "process_supervisor" = "process_supervisor", + "process_manager" = "process_manager", + "reject" = "reject", + "complete" = "complete", +} + +export enum TrxMaintenanceRemark { + "submit" = "Submit", + "process_supervisor" = "On Process Supervisor", + "process_manager" = "On Process Manager", + "reject" = "Reject", + "complete" = "Complete", +} + +export enum TrxMaintenanceActionType { + "create" = "create", + "update" = "update", + "delete" = "delete", +} + ////