From 08c79bb8eb82ba27fdb8fc9e5d8cb7f2f458b8c4 Mon Sep 17 00:00:00 2001 From: "fazri.is" Date: Mon, 6 Oct 2025 13:56:30 +0700 Subject: [PATCH] up --- src/entity/trx_recepient_swift.ts | 79 ++++++++++++++++++++++ src/entity/trx_sender_swift.ts | 72 ++++++++++++++++++++ src/entity/trx_transaction_swift.ts | 100 ++++++++++++++++++++++++++++ src/entity/trx_transactions.ts | 5 ++ src/schema/trx.ts | 3 + 5 files changed, 259 insertions(+) create mode 100644 src/entity/trx_recepient_swift.ts create mode 100644 src/entity/trx_sender_swift.ts create mode 100644 src/entity/trx_transaction_swift.ts diff --git a/src/entity/trx_recepient_swift.ts b/src/entity/trx_recepient_swift.ts new file mode 100644 index 0000000..d62a200 --- /dev/null +++ b/src/entity/trx_recepient_swift.ts @@ -0,0 +1,79 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { Status } from "../types/status"; +import { TrxConfigNationality } from "./trx_config_nationalities"; +import { TrxTransactionSwift } from "./trx_transaction_swift"; +import { TrxConfigBank } from "./trx_config_banks"; + +@Entity("trx_recepient_swifts", { schema: "trx" }) +export class TrxRecepientSwift { + @PrimaryGeneratedColumn("uuid") + id: string; + + @OneToOne(() => TrxTransactionSwift, (transaction_swift) => transaction_swift.recepient_swift, { onDelete: "CASCADE" }) + transaction_swift: TrxTransactionSwift; + + @Column({ + nullable: false, + length: 256, + }) + name: string; + + @Column({ + nullable: false, + length: 256, + }) + iban: string; + + @Column({ + nullable: false, + length: 256, + }) + phone: string; + + @ManyToOne(() => TrxConfigBank, { onDelete: "NO ACTION", nullable: false }) + @JoinColumn() + recepient_bank: TrxConfigBank; + + @Column({ + nullable: false, + length: 256, + }) + account_number: string; + + @Column({ + nullable: true, + length: 4096, + }) + address: string; + + @ManyToOne(() => TrxConfigNationality, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + nationality: TrxConfigNationality; + + @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/trx_sender_swift.ts b/src/entity/trx_sender_swift.ts new file mode 100644 index 0000000..af95161 --- /dev/null +++ b/src/entity/trx_sender_swift.ts @@ -0,0 +1,72 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { Status } from "../types/status"; +import { TrxConfigNationality } from "./trx_config_nationalities"; +import { TrxCompanyAccount } from "./trx_company_accounts"; +import { TrxTransactionSwift } from "./trx_transaction_swift"; +import { TrxConfigBank } from "./trx_config_banks"; + +@Entity("trx_sender_swifts", { schema: "trx" }) +export class TrxSenderSwift { + @PrimaryGeneratedColumn("uuid") + id: string; + + @OneToOne(() => TrxTransactionSwift, (transaction) => transaction.sender_swift, { onDelete: "CASCADE" }) + transaction_swift: TrxTransactionSwift; + + @Column({ + nullable: false, + length: 256, + }) + name: string; + + @Column({ + nullable: false, + length: 256, + }) + phone: string; + + @Column({ + nullable: true, + length: 4096, + }) + address: string; + + @ManyToOne(() => TrxConfigNationality, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + nationality: TrxConfigNationality; + + @ManyToOne(() => TrxCompanyAccount, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + company_account: TrxCompanyAccount; + + @ManyToOne(() => TrxConfigBank, { onDelete: "NO ACTION", nullable: false }) + @JoinColumn() + sender_bank: TrxConfigBank; + + @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/trx_transaction_swift.ts b/src/entity/trx_transaction_swift.ts new file mode 100644 index 0000000..c8c4123 --- /dev/null +++ b/src/entity/trx_transaction_swift.ts @@ -0,0 +1,100 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { TrxCompany } from "./trx_companies"; +import { TrxConfigSourceIncome } from "./trx_config_source_incomes"; +import { TrxSenderSwift } from "./trx_sender_swift"; +import { TrxRecepientSwift } from "./trx_recepient_swift"; +import { TrxTransaction } from "./trx_transactions"; +import { TrxTransactionTypeStatus, TrxTransactionCorrespondentFees, TrxTransactionStatus } from "./../types/trx"; + +@Entity("trx_transaction_swifts", { schema: "trx" }) +export class TrxTransactionSwift { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + length: 256, + }) + type_transaction: TrxTransactionTypeStatus; + + @Column({ + nullable: true, + length: 256, + }) + correspondent_fees: string; + + @Column({ type: "float8" }) + amount_overbooking: number; + + @Column({ type: "float8", nullable: true }) + transfer_amount: number; + + @Column({ type: "float8", nullable: true }) + transfer_total: number; + + @Column({ type: "float8", nullable: true }) + commission: number; + + @Column({ type: "float8", nullable: true }) + cost_of_sender: number; + + @Column({ type: "float8", nullable: true }) + sub_total: number; + + @Column({ type: "float8", nullable: false, default: 0 }) + rate_idr: number; + + @OneToOne(() => TrxTransaction, (transaction) => transaction.transaction_swift, { onDelete: "CASCADE" }) + transaction: TrxTransaction; + + @ManyToOne(() => TrxConfigSourceIncome, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + source_income: TrxConfigSourceIncome; + + @OneToOne(() => TrxSenderSwift, (sender) => sender.transaction_swift, { cascade: true }) + @JoinColumn() + sender_swift: TrxSenderSwift; + + @OneToOne(() => TrxRecepientSwift, (recepient) => recepient.transaction_swift, { cascade: true }) + @JoinColumn() + recepient_swift: TrxRecepientSwift; + + @Column({ + nullable: true, + length: 4096, + }) + file: String; + + @Column({ + nullable: true, + length: 256, + }) + bic: String; + + @Column({ + nullable: true, + length: 4096, + }) + invoice: 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_transactions.ts b/src/entity/trx_transactions.ts index 2fe5710..f3f15fe 100644 --- a/src/entity/trx_transactions.ts +++ b/src/entity/trx_transactions.ts @@ -3,6 +3,7 @@ import { TrxCompany } from "./trx_companies"; import { TrxTransactionDomestic } from "./trx_transaction_domestic"; import { TrxTransactionTransferStatus, TrxTransactionStatus } from "./../types/trx"; import { TrxTransactionRemittance } from "./trx_transaction_remittance"; +import { TrxTransactionSwift } from "./trx_transaction_swift"; @Entity("trx_transactions", { schema: "trx" }) export class TrxTransaction { @@ -21,6 +22,10 @@ export class TrxTransaction { @JoinColumn() transaction_remittance: TrxTransactionRemittance; + @OneToOne(() => TrxTransactionSwift, (transaction_swift) => transaction_swift.transaction, { cascade: true }) + @JoinColumn() + transaction_swift: TrxTransactionSwift; + @Column({ nullable: false, length: 256, diff --git a/src/schema/trx.ts b/src/schema/trx.ts index 752723b..807dff0 100644 --- a/src/schema/trx.ts +++ b/src/schema/trx.ts @@ -36,4 +36,7 @@ export * from "../entity/trx_recepient_domestic"; export * from "../entity/trx_transaction_domestic"; export * from "../entity/trx_transaction_remittance"; export * from "../entity/trx_transactions"; +export * from "../entity/trx_transaction_swift"; +export * from "../entity/trx_sender_swift"; +export * from "../entity/trx_recepient_swift"; export * from "../types/trx";