From 72b71d2d66d958c119e00dc9fb35650748d62d2e Mon Sep 17 00:00:00 2001 From: fro1991 Date: Sun, 6 Jul 2025 00:27:46 +0700 Subject: [PATCH 1/5] update --- src/entity/briva_accounts.ts | 114 +++++++++++---------- src/entity/briva_company_account_labels.ts | 44 ++++++++ src/index.ts | 2 + 3 files changed, 106 insertions(+), 54 deletions(-) create mode 100644 src/entity/briva_company_account_labels.ts diff --git a/src/entity/briva_accounts.ts b/src/entity/briva_accounts.ts index cd97a6e..be03705 100644 --- a/src/entity/briva_accounts.ts +++ b/src/entity/briva_accounts.ts @@ -1,68 +1,74 @@ -import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from 'typeorm'; +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from "typeorm"; -import { Status } from '../types/status'; -import { BrivaCompany } from './briva_companies'; +import { Status } from "../types/status"; +import { BrivaCompany } from "./briva_companies"; -@Entity('briva_accounts', { schema: 'brivas' }) +@Entity("briva_accounts", { schema: "brivas" }) export class BrivaAccount { - @PrimaryGeneratedColumn('uuid') - id: string; + @PrimaryGeneratedColumn("uuid") + id: string; - @Column({ - nullable: false, - unique: true, - length: 256 - }) - code: string; + @Column({ + nullable: false, + unique: true, + length: 256, + }) + code: string; - @Column({ - nullable: true, - length: 256 - }) - name: string; + @Column({ + nullable: true, + length: 256, + }) + name: string; - @Column({ - nullable: false, - length: 256 - }) - account_number: string; + @Column({ + nullable: false, + length: 256, + }) + account_number: string; - @Column({ - nullable: false, - length: 256 - }) - account_holder: string; + @Column({ + nullable: false, + length: 256, + }) + account_holder: string; - @ManyToOne(() => BrivaCompany, { onDelete: 'NO ACTION', nullable: true }) - @JoinTable() - company: BrivaCompany + @ManyToOne(() => BrivaCompany, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + company: BrivaCompany; - @Column({ - nullable: true - }) - last_trans_at: Date; + @Column({ + type: "jsonb", + nullable: true, + }) + labels: any[]; - @Column({ - nullable: true, - length: 256 - }) - last_trans_ref_number: string; + @Column({ + nullable: true, + }) + last_trans_at: Date; - @Column({ - nullable: true, - type: 'float8' - }) - last_trans_amount: number; + @Column({ + nullable: true, + length: 256, + }) + last_trans_ref_number: string; - @Column() - @CreateDateColumn() - created_at: Date; + @Column({ + nullable: true, + type: "float8", + }) + last_trans_amount: number; - @Column({ nullable: true }) - @UpdateDateColumn() - updated_at: Date; + @Column() + @CreateDateColumn() + created_at: Date; - @Column({ nullable: true }) - @DeleteDateColumn() - deleted_at: Date; -} \ No newline at end of file + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; +} diff --git a/src/entity/briva_company_account_labels.ts b/src/entity/briva_company_account_labels.ts new file mode 100644 index 0000000..9ac469f --- /dev/null +++ b/src/entity/briva_company_account_labels.ts @@ -0,0 +1,44 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from "typeorm"; + +import { Status } from "../types/status"; +import { BrivaCompany } from "./briva_companies"; + +@Entity("briva_company_account_labels", { schema: "brivas" }) +export class BrivaCompanyAccountLabel { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => BrivaCompany, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + company: BrivaCompany; + + @Column({ + nullable: false, + length: 256, + }) + label: string; + + @Column({ + nullable: false, + length: 256, + }) + prefix_code: string; + + @Column({ + nullable: false, + length: 256, + }) + value: string; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; +} diff --git a/src/index.ts b/src/index.ts index 11e2488..741126d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -61,6 +61,7 @@ import { BrivaCompanyUser } from "./entity/briva_company_users"; import { BrivaCompanyUserRefreshToken } from "./entity/briva_company_user_refresh_token"; import { BrivaAccount } from "./entity/briva_accounts"; import { BrivaTransaction } from "./entity/briva_transactions"; +import { BrivaCompanyAccountLabel } from "./entity/briva_company_account_labels"; import { AssetSupplier } from "./entity/asset_supplier"; import { AssetFixedClassification } from "./entity/asset_fixed_classification"; @@ -274,6 +275,7 @@ export { BrivaCompanyUserRefreshToken, BrivaAccount, BrivaTransaction, + BrivaCompanyAccountLabel, AssetSupplier, AssetFixedClassification, AssetFixedType, From 9fe5ec64f6f219153debf989eeed5684f66a522b Mon Sep 17 00:00:00 2001 From: fro1991 Date: Sun, 6 Jul 2025 01:57:14 +0700 Subject: [PATCH 2/5] update --- src/entity/briva_account_labels.ts | 32 ++++++++++++++++++++++++++++++ src/index.ts | 4 +++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/entity/briva_account_labels.ts diff --git a/src/entity/briva_account_labels.ts b/src/entity/briva_account_labels.ts new file mode 100644 index 0000000..3716f57 --- /dev/null +++ b/src/entity/briva_account_labels.ts @@ -0,0 +1,32 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from "typeorm"; + +import { Status } from "../types/status"; +import { BrivaCompany } from "./briva_companies"; +import { BrivaCompanyAccountLabel } from "./briva_company_account_labels"; +import { BrivaAccount } from "./briva_accounts"; + +@Entity("briva_account_labels", { schema: "brivas" }) +export class BrivaAccountLabel { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => BrivaAccount, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + account: BrivaAccount; + + @ManyToOne(() => BrivaCompanyAccountLabel, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + company_account_label: BrivaCompanyAccountLabel; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; +} diff --git a/src/index.ts b/src/index.ts index 741126d..eb42e66 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,6 +62,7 @@ import { BrivaCompanyUserRefreshToken } from "./entity/briva_company_user_refres import { BrivaAccount } from "./entity/briva_accounts"; import { BrivaTransaction } from "./entity/briva_transactions"; import { BrivaCompanyAccountLabel } from "./entity/briva_company_account_labels"; +import { BrivaAccountLabel } from "./entity/briva_account_labels"; import { AssetSupplier } from "./entity/asset_supplier"; import { AssetFixedClassification } from "./entity/asset_fixed_classification"; @@ -271,11 +272,12 @@ export { TellerMutation, LogHikvision, BrivaCompany, + BrivaCompanyAccountLabel, BrivaCompanyUser, BrivaCompanyUserRefreshToken, BrivaAccount, + BrivaAccountLabel, BrivaTransaction, - BrivaCompanyAccountLabel, AssetSupplier, AssetFixedClassification, AssetFixedType, From 2091f8bab49250e0ad1e1f7c906fd0d9d58e727c Mon Sep 17 00:00:00 2001 From: fro1991 Date: Sun, 6 Jul 2025 01:57:27 +0700 Subject: [PATCH 3/5] update --- src/entity/briva_accounts.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/entity/briva_accounts.ts b/src/entity/briva_accounts.ts index be03705..4b66186 100644 --- a/src/entity/briva_accounts.ts +++ b/src/entity/briva_accounts.ts @@ -37,12 +37,6 @@ export class BrivaAccount { @JoinTable() company: BrivaCompany; - @Column({ - type: "jsonb", - nullable: true, - }) - labels: any[]; - @Column({ nullable: true, }) From 4fcba399a9c38e666be9df20abce23e14fafbc4f Mon Sep 17 00:00:00 2001 From: fro1991 Date: Sun, 6 Jul 2025 22:19:54 +0700 Subject: [PATCH 4/5] update --- src/entity/brilink_transactions.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/entity/brilink_transactions.ts b/src/entity/brilink_transactions.ts index 082ca34..93a3134 100644 --- a/src/entity/brilink_transactions.ts +++ b/src/entity/brilink_transactions.ts @@ -109,6 +109,17 @@ export class BrilinkTransaction { }) remarks: string; + @Column({ + length: 128, + nullable: true, + }) + refund_reference: string; + + @Column({ + nullable: true, + }) + refund_at: Date; + @Column({ nullable: false, default: false, From 9d4affd2f1b5589262df9fc523fd445d5749eae0 Mon Sep 17 00:00:00 2001 From: fro1991 Date: Sun, 6 Jul 2025 22:43:15 +0700 Subject: [PATCH 5/5] update --- src/entity/brilink_transactions.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/entity/brilink_transactions.ts b/src/entity/brilink_transactions.ts index 93a3134..44144db 100644 --- a/src/entity/brilink_transactions.ts +++ b/src/entity/brilink_transactions.ts @@ -115,6 +115,9 @@ export class BrilinkTransaction { }) refund_reference: string; + @Column({ type: "varchar", length: 255, nullable: true }) + refund_by: string; + @Column({ nullable: true, })