diff --git a/src/entity/asset_request_order.ts b/src/entity/asset_request_order.ts index 6da228b..1ec6d35 100644 --- a/src/entity/asset_request_order.ts +++ b/src/entity/asset_request_order.ts @@ -1,136 +1,129 @@ -import { - Entity, - PrimaryGeneratedColumn, - Column, - CreateDateColumn, - UpdateDateColumn, - DeleteDateColumn, - ManyToOne, - JoinColumn, - JoinTable -} from 'typeorm'; -import { AssetRequestOrderCategory } from './asset_request_order_category'; -import { AssetSupplier } from './asset_supplier'; +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn, JoinTable } from "typeorm"; +import { AssetRequestOrderCategory } from "./asset_request_order_category"; +import { AssetSupplier } from "./asset_supplier"; -@Entity('asset_request_orders') +@Entity("asset_request_orders") export class AssetRequestOrder { - @PrimaryGeneratedColumn('uuid') - id: string; + @PrimaryGeneratedColumn("uuid") + id: string; - @ManyToOne(() => AssetRequestOrderCategory, { onDelete: 'CASCADE' }) - @JoinTable() - request_order_category: AssetRequestOrderCategory; + @ManyToOne(() => AssetRequestOrderCategory, { onDelete: "CASCADE" }) + @JoinTable() + request_order_category: AssetRequestOrderCategory; - @Column({ type: 'varchar', length: 255 }) - department_id: string; + @Column({ type: "varchar", length: 255 }) + department_id: string; - @Column({ type: 'varchar', length: 255 }) - department_name: string; + @Column({ type: "varchar", length: 255 }) + department_name: string; - @ManyToOne(() => AssetSupplier, { onDelete: 'NO ACTION', nullable: true }) - @JoinTable() - supplier: AssetSupplier; + @ManyToOne(() => AssetSupplier, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + supplier: AssetSupplier; - @Column({ type: 'varchar', length: 50, unique: true, nullable: true }) - code: string; + @Column({ type: "varchar", length: 50, unique: true, nullable: true }) + code: string; - @Column({ type: 'varchar', length: 50 }) - type: string; + @Column({ type: "varchar", length: 50 }) + type: string; - @Column({ - type: 'date', nullable: true, - }) - request_at: Date; + @Column({ + type: "date", + nullable: true, + }) + request_at: Date; - @Column({ type: 'text', nullable: true }) - description: string; + @Column({ type: "text", nullable: true }) + description: string; - @Column({ type: 'float8', nullable: false, default: 0 }) - rate_idr: number; + @Column({ type: "float8", nullable: false, default: 0 }) + rate_idr: number; - @Column({ type: 'int2' }) - quantity: number; + @Column({ type: "int2" }) + quantity: number; - @Column({ type: 'float8', nullable: true }) - sub_total: number; + @Column({ type: "float8", nullable: true }) + sub_total: number; - @Column({ - type: 'float8', nullable: false, default: 0 - }) - discount: number; + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + discount: number; - @Column({ type: 'int2', nullable: true }) - tax_percent: number; + @Column({ type: "int2", nullable: true }) + tax_percent: number; - @Column({ type: 'float8', nullable: true }) - tax_amount: number; + @Column({ type: "float8", nullable: true }) + tax_amount: number; - @Column({ type: 'float8' }) - total: number; + @Column({ type: "float8" }) + total: number; - @Column({ nullable: true, length: 4096 }) - file: string; + @Column({ nullable: true, length: 4096 }) + file: string; - @Column({ nullable: true, length: 256 }) - nota_dinas: string; + @Column({ nullable: true, length: 256 }) + nota_dinas: string; - @Column({ type: 'varchar', length: 50, default: 'pending' }) - status: string; + @Column({ type: "varchar", length: 50, default: "pending" }) + status: string; - @Column({ type: 'boolean', nullable: true }) - is_spv_approved: boolean; + @Column({ type: "boolean", nullable: true }) + is_spv_approved: boolean; - @Column({ type: 'varchar', length: 100, nullable: true }) - spv_approved_by: string; + @Column({ type: "varchar", length: 100, nullable: true }) + spv_approved_by: string; - @Column({ nullable: true }) - spv_approved_at: Date; + @Column({ nullable: true }) + spv_approved_at: Date; - @Column({ type: 'text', nullable: true }) - spv_approved_note: string; + @Column({ type: "text", nullable: true }) + spv_approved_note: string; - @Column({ type: 'boolean', nullable: true }) - is_ga_approved: boolean; + @Column({ type: "boolean", nullable: true }) + is_ga_approved: boolean; - @Column({ type: 'varchar', length: 100, nullable: true }) - ga_approved_by: string; + @Column({ type: "varchar", length: 100, nullable: true }) + ga_approved_by: string; - @Column({ nullable: true }) - ga_approved_at: Date; + @Column({ nullable: true }) + ga_approved_at: Date; - @Column({ type: 'text', nullable: true }) - ga_approved_note: string; + @Column({ type: "text", nullable: true }) + ga_approved_note: string; - @Column({ type: 'boolean', nullable: true }) - is_gm_approved: boolean; + @Column({ type: "boolean", nullable: true }) + is_gm_approved: boolean; - @Column({ type: 'varchar', length: 100, nullable: true }) - gm_approved_by: string; + @Column({ type: "varchar", length: 100, nullable: true }) + gm_approved_by: string; - @Column({ nullable: true }) - gm_approved_at: Date; + @Column({ nullable: true }) + gm_approved_at: Date; - @Column({ type: 'text', nullable: true }) - gm_approved_note: string; + @Column({ type: "text", nullable: true }) + gm_approved_note: string; - @Column() - @CreateDateColumn() - created_at: Date; + @Column() + @CreateDateColumn() + created_at: Date; - @Column({ type: 'varchar', length: 100, nullable: true }) - created_by: string; + @Column({ type: "varchar", length: 100, nullable: true }) + created_by: string; - @Column({ nullable: true }) - @UpdateDateColumn() - updated_at: Date;; + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; - @Column({ type: 'varchar', length: 100, nullable: true }) - updated_by: string; + @Column({ type: "varchar", length: 100, nullable: true }) + updated_by: string; - @Column({ nullable: true }) - @DeleteDateColumn() - deleted_at: Date;; + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; - @Column({ type: 'varchar', length: 100, nullable: true }) - deleted_by: string; + @Column({ type: "varchar", length: 100, nullable: true }) + deleted_by: string; } diff --git a/src/entity/trx_transaction_recepients.ts b/src/entity/trx_transaction_recepients.ts new file mode 100644 index 0000000..7ea88f8 --- /dev/null +++ b/src/entity/trx_transaction_recepients.ts @@ -0,0 +1,78 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { TrxCompany } from "./trx_companies"; +import { Status } from "../types/status"; +import { TrxCif } from "./trx_cifs"; +import { TrxConfigNationality } from "./trx_config_nationalities"; +import { TrxTransaction } from "./trx_transactions"; +import { TrxConfigSourceIncome } from "./trx_config_source_incomes"; +import { TrxTransactionType, TrxTransactionCorrespondentFees } from "./../types/trx"; + +@Entity("trx_transaction_recepients", { schema: "trx" }) +export class TrxTransactionRecepient { + @PrimaryGeneratedColumn("uuid") + id: string; + + @OneToOne(() => TrxTransaction, (transaction) => transaction.recepient, { onDelete: "CASCADE" }) + transaction: TrxTransaction; + + @Column({ + nullable: false, + length: 256, + }) + name: string; + + @Column({ + nullable: false, + length: 256, + }) + phone: string; + + @Column({ + nullable: false, + length: 256, + }) + bank: string; + + @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_transaction_senders.ts b/src/entity/trx_transaction_senders.ts new file mode 100644 index 0000000..5f3433f --- /dev/null +++ b/src/entity/trx_transaction_senders.ts @@ -0,0 +1,73 @@ +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 { TrxTransaction } from "./trx_transactions"; + +@Entity("trx_transaction_senders", { schema: "trx" }) +export class TrxTransactionSender { + @PrimaryGeneratedColumn("uuid") + id: string; + + @OneToOne(() => TrxTransaction, (transaction) => transaction.sender, { onDelete: "CASCADE" }) + transaction: TrxTransaction; + + @Column({ + nullable: false, + length: 256, + }) + name: string; + + @Column({ + nullable: false, + length: 256, + }) + phone: string; + + @Column({ + nullable: false, + length: 256, + }) + bank: 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; + + @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_transactions.ts b/src/entity/trx_transactions.ts new file mode 100644 index 0000000..d120c55 --- /dev/null +++ b/src/entity/trx_transactions.ts @@ -0,0 +1,125 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { TrxCompany } from "./trx_companies"; +import { Status } from "../types/status"; +import { TrxCif } from "./trx_cifs"; +import { TrxCompanyAccount } from "./trx_company_accounts"; +import { TrxConfigSourceIncome } from "./trx_config_source_incomes"; +import { TrxTransactionSender } from "./trx_transaction_senders"; +import { TrxTransactionRecepient } from "./trx_transaction_recepients"; +import { TrxTransactionType, TrxTransactionCorrespondentFees, TrxTransactionStatusType } from "./../types/trx"; + +@Entity("trx_transactions", { schema: "trx" }) +export class TrxTransaction { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + length: 256, + unique: true, + }) + code: string; + + @Column({ + nullable: false, + length: 256, + }) + type: TrxTransactionType; + + @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; + + @Column({ + nullable: true, + length: 4096, + }) + signatures: String; + + @Column({ type: "boolean", nullable: true }) + is_teller_approved: boolean; + + @Column({ type: "varchar", length: 100, nullable: true }) + teller_approved_by: string; + + @Column({ nullable: true }) + teller_approved_at: Date; + + @Column({ + nullable: true, + length: 4096, + }) + teller_signatures: String; + + @ManyToOne(() => TrxConfigSourceIncome, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + source_income: TrxConfigSourceIncome; + + @OneToOne(() => TrxTransactionSender, (sender) => sender.transaction, { cascade: true }) + @JoinColumn() + sender: TrxTransactionSender; + + @OneToOne(() => TrxTransactionRecepient, (recepient) => recepient.transaction, { cascade: true }) + @JoinColumn() + recepient: TrxTransactionRecepient; + + @ManyToOne(() => TrxCompany, { onDelete: "NO ACTION", nullable: false }) + @JoinColumn() + company: TrxCompany; + + @Column({ + nullable: false, + length: 64, + }) + status: TrxTransactionStatusType; + + @Column({ nullable: true }) + transaction_at: Date; + + @Column({ nullable: true, length: 256 }) + transaction_by: 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/schema/trx.ts b/src/schema/trx.ts index f9d08df..2544247 100644 --- a/src/schema/trx.ts +++ b/src/schema/trx.ts @@ -27,3 +27,7 @@ export * from "../entity/trx_region_administrativus"; export * from "../entity/trx_region_aldeias"; export * from "../entity/trx_region_sucos"; export * from "../entity/trx_registration"; +export * from "../entity/trx_transaction_senders"; +export * from "../entity/trx_transaction_recepients"; +export * from "../entity/trx_transactions"; +export * from "../types/trx"; diff --git a/src/types/trx.ts b/src/types/trx.ts index 7ce2b3e..478cd11 100644 --- a/src/types/trx.ts +++ b/src/types/trx.ts @@ -6,3 +6,16 @@ export enum TrxTransactionStatusType { "reject" = "reject", "approved" = "approved", } + +export enum TrxTransactionType { + "deposit" = "deposit", + "transfer" = "transfer", + "clearing" = "clearing", + "rtgs" = "rtgs", +} + +export enum TrxTransactionCorrespondentFees { + "sender" = "sender", + "recepient" = "recepient", + "other" = "other", +}