From bea300acb8defd50418cfcb227866868c8bda875 Mon Sep 17 00:00:00 2001 From: fro1991 Date: Wed, 31 Dec 2025 17:01:46 +0700 Subject: [PATCH] update --- src/entity/finance/fincance_budget_lines.ts | 62 ++++++++++++++++++ src/entity/finance/fincance_categories.ts | 57 +++++++++++++++++ .../finance/fincance_sub_budget_lines.ts | 63 +++++++++++++++++++ src/schema/finances.ts | 3 + 4 files changed, 185 insertions(+) create mode 100644 src/entity/finance/fincance_budget_lines.ts create mode 100644 src/entity/finance/fincance_categories.ts create mode 100644 src/entity/finance/fincance_sub_budget_lines.ts diff --git a/src/entity/finance/fincance_budget_lines.ts b/src/entity/finance/fincance_budget_lines.ts new file mode 100644 index 0000000..0348089 --- /dev/null +++ b/src/entity/finance/fincance_budget_lines.ts @@ -0,0 +1,62 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from "typeorm"; + +import { Status } from "../../types/status"; +import { FinanceCategory } from "./fincance_categories"; + +@Entity("finance_budget_lines", { schema: "finance" }) +export class FinanceBudgetLine { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + unique: false, + length: 64, + }) + code: string; + + @Column({ + nullable: false, + unique: false, + length: 64, + }) + name: string; + + @Column({ + nullable: true, + unique: false, + length: 64, + }) + description: string; + + @Column({ + nullable: false, + length: 64, + }) + status: Status; + + @ManyToOne(() => FinanceCategory, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + category: FinanceCategory; + + @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/finance/fincance_categories.ts b/src/entity/finance/fincance_categories.ts new file mode 100644 index 0000000..146c3d2 --- /dev/null +++ b/src/entity/finance/fincance_categories.ts @@ -0,0 +1,57 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from "typeorm"; + +import { Status } from "../../types/status"; + +@Entity("finance_categories", { schema: "finance" }) +export class FinanceCategory { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + unique: false, + length: 64, + }) + code: string; + + @Column({ + nullable: false, + unique: false, + length: 64, + }) + name: string; + + @Column({ + nullable: true, + unique: false, + length: 64, + }) + description: 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; +} diff --git a/src/entity/finance/fincance_sub_budget_lines.ts b/src/entity/finance/fincance_sub_budget_lines.ts new file mode 100644 index 0000000..0ced997 --- /dev/null +++ b/src/entity/finance/fincance_sub_budget_lines.ts @@ -0,0 +1,63 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from "typeorm"; + +import { Status } from "../../types/status"; +import { FinanceCategory } from "./fincance_categories"; +import { FinanceBudgetLine } from "./fincance_budget_lines"; + +@Entity("finance_sub_budget_lines", { schema: "finance" }) +export class FinanceSubBudgetLine { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + unique: false, + length: 64, + }) + code: string; + + @Column({ + nullable: false, + unique: false, + length: 64, + }) + name: string; + + @Column({ + nullable: true, + unique: false, + length: 64, + }) + description: string; + + @Column({ + nullable: false, + length: 64, + }) + status: Status; + + @ManyToOne(() => FinanceBudgetLine, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + budget_line: FinanceBudgetLine; + + @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/finances.ts b/src/schema/finances.ts index add5a81..e369d42 100644 --- a/src/schema/finances.ts +++ b/src/schema/finances.ts @@ -1 +1,4 @@ export * from "../entity/finance/finance_funding_sources"; +export * from "../entity/finance/fincance_categories"; +export * from "../entity/finance/fincance_budget_lines"; +export * from "../entity/finance/fincance_sub_budget_lines";