From eee2be1aa8779ef9d8afe65d1633c1d98f0e7da6 Mon Sep 17 00:00:00 2001 From: fro1991 Date: Wed, 18 Jun 2025 01:45:26 +0900 Subject: [PATCH] update --- package.json | 2 +- src/entity/branchs.ts | 2 +- src/entity/remit_administrativus.ts | 40 ++++ src/entity/remit_aldeias.ts | 42 ++++ src/entity/remit_bank.ts | 53 ----- src/entity/remit_beneficials.ts | 133 ++++++++++++ src/entity/remit_beneficiaries.ts | 85 ++++++++ ..._transactions.ts => remit_config_banks.ts} | 31 ++- ...ions.ts => remit_config_business_types.ts} | 36 ++-- src/entity/remit_config_kurs.ts | 13 +- src/entity/remit_config_nationalities.ts | 49 +++++ src/entity/remit_config_occupations.ts | 49 +++++ ...llocations.ts => remit_config_purposes.ts} | 26 ++- ..._otp.ts => remit_config_source_incomes.ts} | 29 ++- src/entity/remit_munisipos.ts | 35 ++++ src/entity/remit_mutation.ts | 48 ----- src/entity/remit_partner_accounts.ts | 45 +++++ src/entity/remit_partner_apis.ts | 45 +++++ src/entity/remit_partner_documents.ts | 46 +++++ ..._transactions.ts => remit_partner_fees.ts} | 31 ++- src/entity/remit_partner_owners.ts | 112 +++++++++++ src/entity/remit_partner_users.ts | 9 + src/entity/remit_partners.ts | 189 +++++------------- src/entity/remit_region.ts | 69 ------- src/entity/remit_senders.ts | 152 ++++++++++++++ src/entity/remit_sucos.ts | 41 ++++ src/entity/remit_tansfer.ts | 141 ------------- src/entity/remit_topup.ts | 54 ----- src/entity/remit_transactions.ts | 100 +++++++++ src/index.ts | 94 ++++++--- src/types/remit.ts | 61 ++++++ 31 files changed, 1247 insertions(+), 615 deletions(-) create mode 100644 src/entity/remit_administrativus.ts create mode 100644 src/entity/remit_aldeias.ts delete mode 100644 src/entity/remit_bank.ts create mode 100644 src/entity/remit_beneficials.ts create mode 100644 src/entity/remit_beneficiaries.ts rename src/entity/{remit_config_transactions.ts => remit_config_banks.ts} (63%) rename src/entity/{remit_partner_allocations.ts => remit_config_business_types.ts} (56%) create mode 100644 src/entity/remit_config_nationalities.ts create mode 100644 src/entity/remit_config_occupations.ts rename src/entity/{remit_config_allocations.ts => remit_config_purposes.ts} (62%) rename src/entity/{remit_otp.ts => remit_config_source_incomes.ts} (53%) create mode 100644 src/entity/remit_munisipos.ts delete mode 100644 src/entity/remit_mutation.ts create mode 100644 src/entity/remit_partner_accounts.ts create mode 100644 src/entity/remit_partner_apis.ts create mode 100644 src/entity/remit_partner_documents.ts rename src/entity/{remit_partner_transactions.ts => remit_partner_fees.ts} (70%) create mode 100644 src/entity/remit_partner_owners.ts delete mode 100644 src/entity/remit_region.ts create mode 100644 src/entity/remit_senders.ts create mode 100644 src/entity/remit_sucos.ts delete mode 100644 src/entity/remit_tansfer.ts delete mode 100644 src/entity/remit_topup.ts create mode 100644 src/entity/remit_transactions.ts create mode 100644 src/types/remit.ts diff --git a/package.json b/package.json index fc4b034..6f661a6 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "license": "ISC", "dependencies": { "bcryptjs": "^2.4.3", - "typeorm": "^0.3.20" + "typeorm": "^0.3.24" }, "devDependencies": { "@types/bcryptjs": "^2.4.6", diff --git a/src/entity/branchs.ts b/src/entity/branchs.ts index 24dd321..b64bc1d 100644 --- a/src/entity/branchs.ts +++ b/src/entity/branchs.ts @@ -3,7 +3,7 @@ import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateCol import { Status } from "../types/status"; import { BankGaransi } from "./bank_garansi"; -@Entity("branchs") +@Entity("branchs", { schema: 'public' }) export class Branch { @PrimaryGeneratedColumn("uuid") id: string; diff --git a/src/entity/remit_administrativus.ts b/src/entity/remit_administrativus.ts new file mode 100644 index 0000000..fdf180b --- /dev/null +++ b/src/entity/remit_administrativus.ts @@ -0,0 +1,40 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm"; +import { Status } from "../types/status"; +import { RemitMunisipo } from "./remit_munisipos"; + +@Entity("remit_administrativus", { schema: "remits" }) +export class RemitAdministrativu { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => RemitMunisipo, { onDelete: "NO ACTION" }) + @JoinColumn() + munisipo: RemitMunisipo + + @Column({ + nullable: true, + length: 256, + }) + name: 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/remit_aldeias.ts b/src/entity/remit_aldeias.ts new file mode 100644 index 0000000..1a29211 --- /dev/null +++ b/src/entity/remit_aldeias.ts @@ -0,0 +1,42 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm"; +import { Status } from "../types/status"; +import { RemitMunisipo } from "./remit_munisipos"; +import { RemitAdministrativu } from "./remit_administrativus"; +import { RemitSuco } from "./remit_sucos"; + +@Entity("remit_aldeias", { schema: "remits" }) +export class RemitAldeia { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => RemitSuco, { onDelete: "NO ACTION" }) + @JoinColumn() + suco: RemitSuco + + @Column({ + nullable: true, + length: 256, + }) + name: 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/remit_bank.ts b/src/entity/remit_bank.ts deleted file mode 100644 index f2f959d..0000000 --- a/src/entity/remit_bank.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from "typeorm"; - -@Entity("remit_banks", { schema: "remits" }) -export class RemitBank { - @PrimaryGeneratedColumn("uuid") - id: string; - - @Column({ - nullable: false, - unique: false, - length: 256, - }) - name: string; - - @Column({ - nullable: false, - unique: false, - length: 256, - }) - fullname: string; - - @Column({ - nullable: false, - unique: false, - length: 256, - }) - formerly: string; - - @Column({ - nullable: false, - unique: false, - length: 256, - }) - bank_code: string; - - @Column({ - nullable: false, - length: 64, - }) - status: String; - - @Column() - @CreateDateColumn() - created_at: Date; - - @Column({ nullable: true }) - @UpdateDateColumn() - updated_at: Date; - - @Column({ nullable: true }) - @DeleteDateColumn() - deleted_at: Date; -} diff --git a/src/entity/remit_beneficials.ts b/src/entity/remit_beneficials.ts new file mode 100644 index 0000000..de99ede --- /dev/null +++ b/src/entity/remit_beneficials.ts @@ -0,0 +1,133 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { RemitPartner } from "./remit_partners"; +import { District } from "./district"; +import { Munisipo } from "./munisipo"; +import { Administrativu } from "./administrativu"; +import { Suco } from "./suco"; +import { Aldeia } from "./aldeia"; +import { RemitConfigNationalities } from "./remit_config_nationalities"; +import { RemitConfigOccupation } from "./remit_config_occupations"; +import { RemitGender, RemitIdentityType } from "../types/remit"; +import { RemitConfigSourceIncome } from "./remit_config_source_incomes"; +import { RemitMunisipo } from "./remit_munisipos"; +import { RemitAdministrativu } from "./remit_administrativus"; +import { RemitSuco } from "./remit_sucos"; +import { RemitAldeia } from "./remit_aldeias"; + +@Entity("remit_beneficials", { schema: "remits" }) +export class RemitBeneficial { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: true, + length: 256, + }) + name: string; + + @Column({ + nullable: true, + length: 256, + }) + gender: RemitGender; + + @Column({ + nullable: true, + length: 256, + }) + birth_place: string; + + @Column({ + nullable: true, + }) + birth_date: Date; + + @Column({ + nullable: true, + length: 256, + }) + phone: string; + + @Column({ + nullable: true, + length: 256, + }) + email: string; + + @ManyToOne(() => RemitConfigNationalities, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + nationality: RemitConfigNationalities; + + @Column({ + nullable: true, + length: 4096, + }) + address: string; + + @ManyToOne(() => RemitMunisipo, { onDelete: "NO ACTION" }) + @JoinColumn() + munisipo: RemitMunisipo + + @ManyToOne(() => RemitAdministrativu, { onDelete: "NO ACTION" }) + @JoinColumn() + administrativu: RemitAdministrativu + + @ManyToOne(() => RemitSuco, { onDelete: "NO ACTION" }) + @JoinColumn() + suco: RemitSuco + + @ManyToOne(() => RemitAldeia, { onDelete: "NO ACTION" }) + @JoinColumn() + aldeia: RemitAldeia + + @ManyToOne(() => RemitConfigNationalities, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + country: RemitConfigNationalities; + + @ManyToOne(() => RemitConfigOccupation, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + occupation: RemitConfigOccupation; + + @ManyToOne(() => RemitConfigSourceIncome, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + source_income: RemitConfigSourceIncome; + + @Column({ + nullable: true, + length: 4096, + }) + identity_type: RemitIdentityType; + + @Column({ + nullable: true, + length: 4096, + }) + identity_number: String; + + @Column({ + nullable: true, + length: 4096, + }) + identity_file: 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/remit_beneficiaries.ts b/src/entity/remit_beneficiaries.ts new file mode 100644 index 0000000..f75e229 --- /dev/null +++ b/src/entity/remit_beneficiaries.ts @@ -0,0 +1,85 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { RemitPartner } from "./remit_partners"; +import { District } from "./district"; +import { Munisipo } from "./munisipo"; +import { Administrativu } from "./administrativu"; +import { Suco } from "./suco"; +import { Aldeia } from "./aldeia"; +import { RemitConfigNationalities } from "./remit_config_nationalities"; +import { RemitConfigOccupation } from "./remit_config_occupations"; +import { RemitGender, RemitIdentityType, RemitSenderType } from "../types/remit"; +import { RemitConfigSourceIncome } from "./remit_config_source_incomes"; +import { RemitConfigBank } from "./remit_config_banks"; + +@Entity("remit_beneficiaries", { schema: "remits" }) +export class RemitBeneficiary { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: true, + length: 256, + }) + name: string; + + @ManyToOne(() => RemitConfigBank, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + bank: RemitConfigBank; + + @Column({ + nullable: true, + length: 256, + }) + account: string; + + @Column({ + nullable: true, + length: 256, + }) + phone: string; + + @Column({ + nullable: true, + length: 4096, + }) + address: string; + + @Column({ + nullable: true, + length: 256, + }) + identity_type: RemitIdentityType; + + @Column({ + nullable: true, + length: 4096, + }) + identity_number: String; + + @Column({ + nullable: true, + length: 4096, + }) + identity_file: 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/remit_config_transactions.ts b/src/entity/remit_config_banks.ts similarity index 63% rename from src/entity/remit_config_transactions.ts rename to src/entity/remit_config_banks.ts index bc2842c..9bf0822 100644 --- a/src/entity/remit_config_transactions.ts +++ b/src/entity/remit_config_banks.ts @@ -1,38 +1,38 @@ -import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm"; - +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from "typeorm"; import { Status } from "../types/status"; -@Entity("remit_config_transactions", { schema: "remits" }) -export class RemitConfigTransaction { +@Entity("remit_config_banks", { schema: "remits" }) +export class RemitConfigBank { @PrimaryGeneratedColumn("uuid") id: string; @Column({ nullable: true, + unique: true, length: 256, }) - min: string; + code: string; @Column({ nullable: true, length: 256, }) - max: string; + name: string; @Column({ nullable: true, length: 256, }) - type: string; + fullname: string; @Column({ nullable: true, length: 256, }) - value: string; + formerly: string; @Column({ - nullable: false, + nullable: true, length: 64, }) status: Status; @@ -41,23 +41,20 @@ export class RemitConfigTransaction { @CreateDateColumn() created_at: Date; - @Column({ - nullable: true, - length: 256, - }) + @Column({ nullable: true, length: 256, }) created_by: string; @Column({ nullable: true }) @UpdateDateColumn() updated_at: Date; - @Column({ - nullable: true, - length: 256, - }) + @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/remit_partner_allocations.ts b/src/entity/remit_config_business_types.ts similarity index 56% rename from src/entity/remit_partner_allocations.ts rename to src/entity/remit_config_business_types.ts index aec974d..9df5bfc 100644 --- a/src/entity/remit_partner_allocations.ts +++ b/src/entity/remit_config_business_types.ts @@ -1,27 +1,24 @@ -import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from "typeorm"; -import { Status } from "../types/status"; -import { RemitPartner } from "./remit_partners"; +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm"; -@Entity("remit_partner_allocations", { schema: "remits" }) -export class RemitPartnerAllocation { +import { Status } from "../types/status"; +import { RemitRiskLevel } from "../types/remit"; + +@Entity("remit_config_business_types", { schema: "remits" }) +export class RemitConfigBusinessType { @PrimaryGeneratedColumn("uuid") id: string; - @ManyToOne(() => RemitPartner, { onDelete: "CASCADE" }) - @JoinTable() - partner: RemitPartner; - @Column({ nullable: true, length: 256, }) - bri_value: string; + name: string; @Column({ - nullable: true, - length: 256, + nullable: false, + length: 64, }) - partner_value: string; + level: RemitRiskLevel; @Column({ nullable: false, @@ -33,23 +30,20 @@ export class RemitPartnerAllocation { @CreateDateColumn() created_at: Date; - @Column({ - nullable: true, - length: 256, - }) + @Column({ nullable: true, length: 256, }) created_by: string; @Column({ nullable: true }) @UpdateDateColumn() updated_at: Date; - @Column({ - nullable: true, - length: 256, - }) + @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/remit_config_kurs.ts b/src/entity/remit_config_kurs.ts index b723941..72ea709 100644 --- a/src/entity/remit_config_kurs.ts +++ b/src/entity/remit_config_kurs.ts @@ -23,23 +23,20 @@ export class RemitConfigKurs { @CreateDateColumn() created_at: Date; - @Column({ - nullable: true, - length: 256, - }) + @Column({ nullable: true, length: 256, }) created_by: string; @Column({ nullable: true }) @UpdateDateColumn() updated_at: Date; - @Column({ - nullable: true, - length: 256, - }) + @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/remit_config_nationalities.ts b/src/entity/remit_config_nationalities.ts new file mode 100644 index 0000000..68637be --- /dev/null +++ b/src/entity/remit_config_nationalities.ts @@ -0,0 +1,49 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm"; + +import { Status } from "../types/status"; +import { RemitRiskLevel } from "../types/remit"; + +@Entity("remit_config_nationalities", { schema: "remits" }) +export class RemitConfigNationalities { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: true, + length: 256, + }) + name: string; + + @Column({ + nullable: false, + length: 64, + }) + level: RemitRiskLevel; + + @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/remit_config_occupations.ts b/src/entity/remit_config_occupations.ts new file mode 100644 index 0000000..1f3701f --- /dev/null +++ b/src/entity/remit_config_occupations.ts @@ -0,0 +1,49 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm"; + +import { Status } from "../types/status"; +import { RemitRiskLevel } from "../types/remit"; + +@Entity("remit_config_occupations", { schema: "remits" }) +export class RemitConfigOccupation { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: true, + length: 256, + }) + name: string; + + @Column({ + nullable: false, + length: 64, + }) + level: RemitRiskLevel; + + @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/remit_config_allocations.ts b/src/entity/remit_config_purposes.ts similarity index 62% rename from src/entity/remit_config_allocations.ts rename to src/entity/remit_config_purposes.ts index f6edc2f..21a4c4d 100644 --- a/src/entity/remit_config_allocations.ts +++ b/src/entity/remit_config_purposes.ts @@ -1,9 +1,10 @@ import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm"; import { Status } from "../types/status"; +import { RemitRiskLevel } from "../types/remit"; -@Entity("remit_config_allocations", { schema: "remits" }) -export class RemitConfigAllocation { +@Entity("remit_config_purposes", { schema: "remits" }) +export class RemitConfigPurpose { @PrimaryGeneratedColumn("uuid") id: string; @@ -11,13 +12,13 @@ export class RemitConfigAllocation { nullable: true, length: 256, }) - bri_value: string; + name: string; @Column({ - nullable: true, - length: 256, + nullable: false, + length: 64, }) - partner_value: string; + level: RemitRiskLevel; @Column({ nullable: false, @@ -29,23 +30,20 @@ export class RemitConfigAllocation { @CreateDateColumn() created_at: Date; - @Column({ - nullable: true, - length: 256, - }) + @Column({ nullable: true, length: 256, }) created_by: string; @Column({ nullable: true }) @UpdateDateColumn() updated_at: Date; - @Column({ - nullable: true, - length: 256, - }) + @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/remit_otp.ts b/src/entity/remit_config_source_incomes.ts similarity index 53% rename from src/entity/remit_otp.ts rename to src/entity/remit_config_source_incomes.ts index 213e6bb..046b8f4 100644 --- a/src/entity/remit_otp.ts +++ b/src/entity/remit_config_source_incomes.ts @@ -1,36 +1,49 @@ import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm"; import { Status } from "../types/status"; +import { RemitRiskLevel } from "../types/remit"; -@Entity("remit_otp", { schema: "remits" }) -export class RemitOtp { +@Entity("remit_config_source_incomes", { schema: "remits" }) +export class RemitConfigSourceIncome { @PrimaryGeneratedColumn("uuid") id: string; @Column({ - nullable: false, + nullable: true, length: 256, }) - username: string; + name: string; @Column({ nullable: false, - length: 256, + length: 64, }) - otp: string; + level: RemitRiskLevel; - @Column("timestamp") - expired_at: Date; + @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/remit_munisipos.ts b/src/entity/remit_munisipos.ts new file mode 100644 index 0000000..37cc7ac --- /dev/null +++ b/src/entity/remit_munisipos.ts @@ -0,0 +1,35 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from "typeorm"; +import { Status } from "../types/status"; + +@Entity("remit_munisipos", { schema: "remits" }) +export class RemitMunisipo { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: true, + length: 256, + }) + name: 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/remit_mutation.ts b/src/entity/remit_mutation.ts deleted file mode 100644 index 4c04c38..0000000 --- a/src/entity/remit_mutation.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinTable } from "typeorm"; -import { RemitPartner } from "./remit_partners"; - -@Entity("remit_mutation", { schema: "remits" }) -export class RemitMutation { - @PrimaryGeneratedColumn("uuid") - id: string; - - @Column({ - type: "uuid", - default: () => "uuid_generate_v4()", - }) - refId: string; - - @ManyToOne(() => RemitPartner, { onDelete: "CASCADE" }) - @JoinTable() - partner: RemitPartner; - - @Column({ - nullable: false, - length: 256, - }) - type: string; - - @Column({ - nullable: false, - length: 256, - }) - amount: string; - - @Column({ - nullable: false, - length: 256, - }) - status: string; - - @Column() - @CreateDateColumn() - created_at: Date; - - @Column({ nullable: true }) - @UpdateDateColumn() - updated_at: Date; - - @Column({ nullable: true }) - @DeleteDateColumn() - deleted_at: Date; -} diff --git a/src/entity/remit_partner_accounts.ts b/src/entity/remit_partner_accounts.ts new file mode 100644 index 0000000..6f275e3 --- /dev/null +++ b/src/entity/remit_partner_accounts.ts @@ -0,0 +1,45 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { RemitPartner } from "./remit_partners"; + +@Entity("remit_partner_accounts", { schema: "remits" }) +export class RemitPartnerAccounts { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => RemitPartner, { onDelete: "RESTRICT" }) + @JoinColumn() + partner: RemitPartner; + + @Column({ + nullable: true, + length: 256, + }) + number: string; + + @Column({ + nullable: true, + length: 256, + }) + holder: 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/remit_partner_apis.ts b/src/entity/remit_partner_apis.ts new file mode 100644 index 0000000..3ed888b --- /dev/null +++ b/src/entity/remit_partner_apis.ts @@ -0,0 +1,45 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { RemitPartner } from "./remit_partners"; + +@Entity("remit_partner_apis", { schema: "remits" }) +export class RemitPartnerApis { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => RemitPartner, { onDelete: "RESTRICT" }) + @JoinColumn() + partner: RemitPartner; + + @Column({ + nullable: true, + length: 256, + }) + consumer_key: string; + + @Column({ + nullable: true, + length: 256, + }) + consumer_secret: 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/remit_partner_documents.ts b/src/entity/remit_partner_documents.ts new file mode 100644 index 0000000..834da21 --- /dev/null +++ b/src/entity/remit_partner_documents.ts @@ -0,0 +1,46 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { RemitPartner } from "./remit_partners"; +import { RemitDocumentType } from "../types/remit"; + +@Entity("remit_partner_documents", { schema: "remits" }) +export class RemitPartnerDocument { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => RemitPartner, { onDelete: "RESTRICT" }) + @JoinColumn() + partner: RemitPartner; + + @Column({ + nullable: true, + length: 256, + }) + type: RemitDocumentType; + + @Column({ + nullable: true, + length: 4096, + }) + file: 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/remit_partner_transactions.ts b/src/entity/remit_partner_fees.ts similarity index 70% rename from src/entity/remit_partner_transactions.ts rename to src/entity/remit_partner_fees.ts index 7c059b3..a9ccafa 100644 --- a/src/entity/remit_partner_transactions.ts +++ b/src/entity/remit_partner_fees.ts @@ -1,9 +1,10 @@ import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from "typeorm"; import { Status } from "../types/status"; import { RemitPartner } from "./remit_partners"; +import { RemitPartnerFeeType } from "../types/remit"; -@Entity("remit_partner_transactions", { schema: "remits" }) -export class RemitPartnerTransaction { +@Entity("remit_partner_fees", { schema: "remits" }) +export class RemitPartnerFee { @PrimaryGeneratedColumn("uuid") id: string; @@ -27,41 +28,33 @@ export class RemitPartnerTransaction { nullable: true, length: 256, }) - type: string; + type: RemitPartnerFeeType; @Column({ nullable: true, - length: 256, + type: 'float8', + default: 0 }) - value: string; - - @Column({ - nullable: false, - length: 64, - }) - status: Status; + amount: Number; @Column() @CreateDateColumn() created_at: Date; - @Column({ - nullable: true, - length: 256, - }) + @Column({ nullable: true, length: 256, }) created_by: string; @Column({ nullable: true }) @UpdateDateColumn() updated_at: Date; - @Column({ - nullable: true, - length: 256, - }) + @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/remit_partner_owners.ts b/src/entity/remit_partner_owners.ts new file mode 100644 index 0000000..0f4f8f6 --- /dev/null +++ b/src/entity/remit_partner_owners.ts @@ -0,0 +1,112 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { RemitGender, RemitPartnerStatus, RemitPartnerType } from "../types/remit"; +import { Administrativu } from "./administrativu"; +import { Aldeia } from "./aldeia"; +import { District } from "./district"; +import { Munisipo } from "./munisipo"; +import { RemitConfigBusinessType } from "./remit_config_business_types"; +import { RemitConfigSourceIncome } from "./remit_config_source_incomes"; +import { Suco } from "./suco"; +import { RemitPartner } from "./remit_partners"; +import { RemitConfigNationalities } from "./remit_config_nationalities"; +import { RemitBeneficial } from "./remit_beneficials"; +import { RemitMunisipo } from "./remit_munisipos"; +import { RemitAdministrativu } from "./remit_administrativus"; +import { RemitSuco } from "./remit_sucos"; +import { RemitAldeia } from "./remit_aldeias"; + +@Entity("remit_partner_owners", { schema: "remits" }) +export class RemitPartnerOwners { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => RemitPartner, { onDelete: "RESTRICT" }) + @JoinColumn() + partner: RemitPartner; + + @Column({ + nullable: true, + length: 256, + }) + name: string; + + @Column({ + nullable: true, + length: 256, + }) + gender: RemitGender; + + @Column({ + nullable: true, + length: 256, + }) + birth_place: string; + + @Column({ + nullable: true, + }) + birth_date: Date; + + @Column({ + nullable: true, + length: 256, + }) + phone: string; + + @Column({ + nullable: true, + length: 256, + }) + email: string; + + @Column({ + nullable: true, + length: 4096, + }) + address: string; + + @ManyToOne(() => RemitMunisipo, { onDelete: "NO ACTION" }) + @JoinColumn() + munisipo: RemitMunisipo + + @ManyToOne(() => RemitAdministrativu, { onDelete: "NO ACTION" }) + @JoinColumn() + administrativu: RemitAdministrativu + + @ManyToOne(() => RemitSuco, { onDelete: "NO ACTION" }) + @JoinColumn() + suco: RemitSuco + + @ManyToOne(() => RemitAldeia, { onDelete: "NO ACTION" }) + @JoinColumn() + aldeia: RemitAldeia + + @ManyToOne(() => RemitConfigNationalities, { onDelete: "NO ACTION" }) + @JoinColumn() + nationality: RemitConfigNationalities; + + @ManyToOne(() => RemitConfigSourceIncome, { onDelete: "NO ACTION" }) + @JoinColumn() + source_income: RemitConfigSourceIncome; + + @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/remit_partner_users.ts b/src/entity/remit_partner_users.ts index e811065..93491df 100644 --- a/src/entity/remit_partner_users.ts +++ b/src/entity/remit_partner_users.ts @@ -60,14 +60,23 @@ export class RemitPartnerUser { @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; + hashPassword() { this.password = bcrypt.hashSync(this.password, 8); } diff --git a/src/entity/remit_partners.ts b/src/entity/remit_partners.ts index df5e43c..5c4d909 100644 --- a/src/entity/remit_partners.ts +++ b/src/entity/remit_partners.ts @@ -1,4 +1,17 @@ -import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from "typeorm"; +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { RemitPartnerStatus, RemitPartnerType } from "../types/remit"; +import { Administrativu } from "./administrativu"; +import { Aldeia } from "./aldeia"; +import { District } from "./district"; +import { Munisipo } from "./munisipo"; +import { RemitConfigBusinessType } from "./remit_config_business_types"; +import { RemitConfigSourceIncome } from "./remit_config_source_incomes"; +import { Suco } from "./suco"; +import { RemitBeneficial } from "./remit_beneficials"; +import { RemitMunisipo } from "./remit_munisipos"; +import { RemitAdministrativu } from "./remit_administrativus"; +import { RemitSuco } from "./remit_sucos"; +import { RemitAldeia } from "./remit_aldeias"; @Entity("remit_partners", { schema: "remits" }) export class RemitPartner { @@ -12,6 +25,12 @@ export class RemitPartner { }) code: string; + @Column({ + nullable: false, + length: 4096, + }) + type: RemitPartnerType; + @Column({ nullable: false, unique: false, @@ -39,165 +58,61 @@ export class RemitPartner { }) address: string; - @Column({ - nullable: false, - length: 4096, - }) - type: string; + @ManyToOne(() => RemitMunisipo, { onDelete: "NO ACTION" }) + @JoinColumn() + munisipo: RemitMunisipo - @Column({ - nullable: false, - unique: false, - length: 256, - }) - municipio_id: string; + @ManyToOne(() => RemitAdministrativu, { onDelete: "NO ACTION" }) + @JoinColumn() + administrativu: RemitAdministrativu - @Column({ - nullable: false, - unique: false, - length: 256, - }) - municipio_name: string; + @ManyToOne(() => RemitSuco, { onDelete: "NO ACTION" }) + @JoinColumn() + suco: RemitSuco - @Column({ - nullable: false, - unique: false, - length: 256, - }) - posto_adm_id: string; + @ManyToOne(() => RemitAldeia, { onDelete: "NO ACTION" }) + @JoinColumn() + aldeia: RemitAldeia - @Column({ - nullable: false, - unique: false, - length: 256, - }) - posto_adm_name: string; + @ManyToOne(() => RemitConfigBusinessType, { onDelete: "NO ACTION" }) + @JoinColumn() + business_type: RemitConfigBusinessType; - @Column({ - nullable: false, - unique: false, - length: 256, - }) - suco_id: string; + @ManyToOne(() => RemitConfigSourceIncome, { onDelete: "NO ACTION" }) + @JoinColumn() + source_income: RemitConfigSourceIncome; - @Column({ - nullable: false, - unique: false, - length: 256, - }) - suco_name: string; - - @Column({ - nullable: false, - unique: false, - length: 256, - }) - aldeia_id: string; - - @Column({ - nullable: false, - unique: false, - length: 256, - }) - aldeia_name: string; - - @Column({ - nullable: false, - unique: false, - length: 256, - }) - document_type: string; - - @Column({ - nullable: false, - unique: false, - length: 256, - }) - document_number: string; - - @Column({ - nullable: false, - unique: false, - length: 256, - }) - document_file: string; - - @Column({ - nullable: true, - unique: false, - length: 256, - }) - account_number_tl: string; - - @Column({ - nullable: true, - unique: false, - length: 256, - }) - account_name_tl: string; - - @Column({ - nullable: false, - unique: false, - length: 256, - }) - pin: string; + @ManyToOne(() => RemitBeneficial, { onDelete: "NO ACTION" }) + @JoinColumn() + benefecial: RemitBeneficial; @Column({ nullable: false, length: 64, }) - status: String; + status: RemitPartnerStatus; - @Column({ - nullable: true, - length: 64, - }) - balance: String; - - @Column({ - nullable: true, - length: 64, - }) - vostro_idr: String; - - @Column({ - nullable: true, - length: 64, - }) - vostro_usd: String; - - @Column({ - nullable: true, - length: 64, - }) - qlola_usr: String; - - @Column({ - nullable: true, - length: 64, - }) - qlola_pwd: String; + @Column({ nullable: true, length: 256, }) + approved_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({ type: "timestamp", nullable: true }) - finalized_at: Date; - - @Column({ - nullable: true, - length: 256, - unique: false, - }) - finalized_by: string; + @Column({ nullable: true, length: 256 }) + deleted_by: string; } diff --git a/src/entity/remit_region.ts b/src/entity/remit_region.ts deleted file mode 100644 index ad750f4..0000000 --- a/src/entity/remit_region.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm"; - -import { Status } from "../types/status"; - -@Entity("remit_region", { schema: "remits" }) -export class RemitRegion { - @PrimaryGeneratedColumn("uuid") - id: string; - - @Column({ - type: "uuid", - default: () => "uuid_generate_v4()", - }) - municipioId: string; - - @Column({ - nullable: false, - length: 256, - }) - municipio_name: string; - - @Column({ - type: "uuid", - default: () => "uuid_generate_v4()", - }) - postoId: string; - - @Column({ - nullable: false, - length: 256, - }) - posto_name: string; - - @Column({ - type: "uuid", - default: () => "uuid_generate_v4()", - }) - sucoId: string; - - @Column({ - nullable: false, - length: 256, - }) - suco_name: string; - - @Column({ - type: "uuid", - default: () => "uuid_generate_v4()", - }) - aldeiaId: string; - - @Column({ - nullable: false, - length: 256, - }) - aldeia_name: string; - - @Column() - @CreateDateColumn() - created_at: Date; - - @Column({ nullable: true }) - @UpdateDateColumn() - updated_at: Date; - - @Column({ nullable: true }) - @DeleteDateColumn() - deleted_at: Date; -} diff --git a/src/entity/remit_senders.ts b/src/entity/remit_senders.ts new file mode 100644 index 0000000..9a930f2 --- /dev/null +++ b/src/entity/remit_senders.ts @@ -0,0 +1,152 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { RemitPartner } from "./remit_partners"; +import { District } from "./district"; +import { Munisipo } from "./munisipo"; +import { Administrativu } from "./administrativu"; +import { Suco } from "./suco"; +import { Aldeia } from "./aldeia"; +import { RemitConfigNationalities } from "./remit_config_nationalities"; +import { RemitConfigOccupation } from "./remit_config_occupations"; +import { RemitGender, RemitIdentityType, RemitSenderType } from "../types/remit"; +import { RemitConfigSourceIncome } from "./remit_config_source_incomes"; +import { RemitBeneficial } from "./remit_beneficials"; +import { RemitMunisipo } from "./remit_munisipos"; +import { RemitAdministrativu } from "./remit_administrativus"; +import { RemitSuco } from "./remit_sucos"; +import { RemitAldeia } from "./remit_aldeias"; + +@Entity("remit_senders", { schema: "remits" }) +export class RemitSender { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: true, + length: 256, + }) + type: RemitSenderType; + + @Column({ + nullable: true, + length: 256, + }) + account_number: string; + + @Column({ + nullable: true, + length: 256, + }) + account_holder: string; + + @Column({ + nullable: true, + length: 256, + }) + name: string; + + @Column({ + nullable: true, + length: 256, + }) + gender: RemitGender; + + @Column({ + nullable: true, + length: 256, + }) + birth_place: string; + + @Column({ + nullable: true, + }) + birth_date: Date; + + @Column({ + nullable: true, + length: 256, + }) + phone: string; + + @Column({ + nullable: true, + length: 256, + }) + email: string; + + @ManyToOne(() => RemitConfigNationalities, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + nationality: RemitConfigNationalities; + + @Column({ + nullable: true, + length: 4096, + }) + address: string; + + @ManyToOne(() => RemitMunisipo, { onDelete: "NO ACTION" }) + @JoinColumn() + munisipo: RemitMunisipo + + @ManyToOne(() => RemitAdministrativu, { onDelete: "NO ACTION" }) + @JoinColumn() + administrativu: RemitAdministrativu + + @ManyToOne(() => RemitSuco, { onDelete: "NO ACTION" }) + @JoinColumn() + suco: RemitSuco + + @ManyToOne(() => RemitAldeia, { onDelete: "NO ACTION" }) + @JoinColumn() + aldeia: RemitAldeia + + @ManyToOne(() => RemitConfigNationalities, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + country: RemitConfigNationalities; + + @ManyToOne(() => RemitConfigOccupation, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + occupation: RemitConfigOccupation; + + @ManyToOne(() => RemitConfigSourceIncome, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + source_income: RemitConfigSourceIncome; + + @Column({ + nullable: true, + length: 4096, + }) + identity_type: RemitIdentityType; + + @Column({ + nullable: true, + length: 4096, + }) + identity_number: String; + + @Column({ + nullable: true, + length: 4096, + }) + identity_file: 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/remit_sucos.ts b/src/entity/remit_sucos.ts new file mode 100644 index 0000000..1aa082e --- /dev/null +++ b/src/entity/remit_sucos.ts @@ -0,0 +1,41 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm"; +import { Status } from "../types/status"; +import { RemitMunisipo } from "./remit_munisipos"; +import { RemitAdministrativu } from "./remit_administrativus"; + +@Entity("remit_sucos", { schema: "remits" }) +export class RemitSuco { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => RemitAdministrativu, { onDelete: "NO ACTION" }) + @JoinColumn() + administrativu: RemitAdministrativu + + @Column({ + nullable: true, + length: 256, + }) + name: 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/remit_tansfer.ts b/src/entity/remit_tansfer.ts deleted file mode 100644 index ad95c73..0000000 --- a/src/entity/remit_tansfer.ts +++ /dev/null @@ -1,141 +0,0 @@ -import bcrypt from "bcryptjs"; -import { Status } from "../types/status"; -import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, OneToOne, JoinColumn, ManyToOne, OneToMany, ManyToMany, JoinTable } from "typeorm"; -import { RemitPartner } from "./remit_partners"; -import { ApprovalStatus } from "../enum/approvalStatus"; - -@Entity("remit_transfer", { schema: "remits" }) -export class RemitTransfer { - @PrimaryGeneratedColumn("uuid") - id: string; - - @Column({ - nullable: false, - unique: true, - length: 256, - }) - ref_number: string; - - @ManyToOne(() => RemitPartner, { onDelete: "CASCADE" }) - @JoinTable() - partner: RemitPartner; - - @Column({ - nullable: true, - length: 64, - unique: false, - }) - bank_name: string; - - @Column({ - nullable: true, - length: 64, - unique: false, - }) - account_number: string; - - @Column({ - nullable: true, - length: 64, - unique: false, - }) - account_name: string; - - @Column({ - nullable: true, - length: 64, - unique: false, - }) - amount: string; - - // new field - @Column({ - nullable: true, - length: 64, - unique: false, - }) - sender_name: string; - - @Column({ - nullable: true, - length: 64, - unique: false, - }) - sender_id_type: string; - - @Column({ - nullable: true, - length: 64, - unique: false, - }) - sender_id_number: string; - - @Column({ - nullable: true, - type: "text", - unique: false, - }) - sender_id_file: string; - - @Column({ - nullable: true, - length: 64, - unique: false, - }) - sender_country: string; - - @Column({ - nullable: false, - length: 64, - }) - status: string; - @Column({ - nullable: true, - length: 64, - }) - transaction_fee: string; - - @Column({ - nullable: true, - length: 64, - }) - allocation_bri_value: string; - - @Column({ - nullable: true, - length: 64, - }) - allocation_partner_value: string; - - @Column({ - nullable: false, - length: 64, - default: "N", - }) - beneficiary: Status; - - @Column() - @CreateDateColumn() - created_at: Date; - - @Column({ type: "timestamp", nullable: true }) - finalized_at: Date; - - @Column({ - nullable: true, - length: 256, - unique: false, - }) - finalized_by: string; - - @Column({ nullable: true }) - approved_at: Date; - - @Column({ nullable: true }) - @UpdateDateColumn() - updated_at: Date; - - @Column({ nullable: true }) - @DeleteDateColumn() - deleted_at: Date; -} diff --git a/src/entity/remit_topup.ts b/src/entity/remit_topup.ts deleted file mode 100644 index 4778e5f..0000000 --- a/src/entity/remit_topup.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinTable } from "typeorm"; -import { RemitPartner } from "./remit_partners"; - -@Entity("remit_topup", { schema: "remits" }) -export class RemitTopup { - @PrimaryGeneratedColumn("uuid") - id: string; - - @Column({ - nullable: false, - unique: true, - length: 256, - }) - ref_number: string; - - @ManyToOne(() => RemitPartner, { onDelete: "CASCADE" }) - @JoinTable() - partner: RemitPartner; - - @Column({ - nullable: true, - length: 64, - unique: false, - }) - amount: string; - - @Column({ - nullable: false, - length: 64, - }) - status: string; - - @Column({ type: "timestamp", nullable: true }) - finalized_at: Date; - - @Column({ - nullable: true, - length: 256, - unique: false, - }) - finalized_by: string; - - @Column() - @CreateDateColumn() - created_at: Date; - - @Column({ nullable: true }) - @UpdateDateColumn() - updated_at: Date; - - @Column({ nullable: true }) - @DeleteDateColumn() - deleted_at: Date; -} diff --git a/src/entity/remit_transactions.ts b/src/entity/remit_transactions.ts new file mode 100644 index 0000000..788bbca --- /dev/null +++ b/src/entity/remit_transactions.ts @@ -0,0 +1,100 @@ +import bcrypt from "bcryptjs"; +import { Status } from "../types/status"; +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, OneToOne, JoinColumn, ManyToOne, OneToMany, ManyToMany, JoinTable } from "typeorm"; +import { RemitPartner } from "./remit_partners"; +import { ApprovalStatus } from "../enum/approvalStatus"; +import { RemitSender } from "./remit_senders"; +import { RemitBeneficiary } from "./remit_beneficiaries"; +import { RemitConfigPurpose } from "./remit_config_purposes"; +import { RemitTransactionCurrencyType, RemitTransactionStatus } from "../types/remit"; +import { RemitBeneficial } from "./remit_beneficials"; + +@Entity("remit_transactions", { schema: "remits" }) +export class RemitTransaction { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + unique: true, + length: 256, + }) + code: string; + + @ManyToOne(() => RemitPartner, { onDelete: "RESTRICT" }) + @JoinTable() + partner: RemitPartner; + + @ManyToOne(() => RemitSender, { onDelete: "RESTRICT" }) + @JoinTable() + sender: RemitSender; + + @ManyToOne(() => RemitBeneficial, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + benefecial: RemitBeneficial; + + @ManyToOne(() => RemitBeneficiary, { onDelete: "RESTRICT" }) + @JoinTable() + beneficiary: RemitBeneficiary; + + @ManyToOne(() => RemitConfigPurpose, { onDelete: "RESTRICT" }) + @JoinTable() + purpose: RemitConfigPurpose; + + @Column({ + nullable: true, + length: 5, + }) + currency: RemitTransactionCurrencyType; + + @Column({ + nullable: false, + type: 'float8', + }) + amount: Number; + + @Column({ + nullable: true, + length: 4096, + }) + selfie_file: String; + + @Column({ + nullable: true, + length: 4096, + }) + underlying_file: String; + + @Column({ + nullable: true, + length: 256, + }) + status: RemitTransactionStatus; + + @Column({ nullable: true }) + approved_at: Date; + + @Column({ nullable: true, length: 256, }) + approved_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/index.ts b/src/index.ts index 75c9c7e..2876e84 100644 --- a/src/index.ts +++ b/src/index.ts @@ -84,19 +84,40 @@ import { AssetInventoryHistory } from "./entity/asset_inventory_histories"; import { AssetInventoryDepreciation } from "./entity/asset_inventory_depreciations"; import { AssetInventoryDepreciationLog } from "./entity/asset_inventory_depreciation_logs"; -import { RemitOtp } from "./entity/remit_otp"; +import { RemitMunisipo } from "./entity/remit_munisipos"; +import { RemitAdministrativu } from "./entity/remit_administrativus"; +import { RemitSuco } from "./entity/remit_sucos"; +import { RemitAldeia } from "./entity/remit_aldeias"; +import { RemitBeneficial } from "./entity/remit_beneficials"; +import { RemitBeneficiary } from "./entity/remit_beneficiaries"; +import { RemitConfigBank } from "./entity/remit_config_banks"; +import { RemitConfigBusinessType } from "./entity/remit_config_business_types"; +import { RemitConfigKurs } from "./entity/remit_config_kurs"; +import { RemitConfigNationalities } from "./entity/remit_config_nationalities"; +import { RemitConfigOccupation } from "./entity/remit_config_occupations"; +import { RemitConfigPurpose } from "./entity/remit_config_purposes"; +import { RemitConfigSourceIncome } from "./entity/remit_config_source_incomes"; +import { RemitPartnerAccounts } from "./entity/remit_partner_accounts"; +import { RemitPartnerApis } from "./entity/remit_partner_apis"; +import { RemitPartnerDocument } from "./entity/remit_partner_documents"; +import { RemitPartnerFee } from "./entity/remit_partner_fees"; +import { RemitPartnerOwners } from "./entity/remit_partner_owners"; import { RemitPartnerUser } from "./entity/remit_partner_users"; import { RemitPartner } from "./entity/remit_partners"; -import { RemitPartnerTransaction } from "./entity/remit_partner_transactions"; -import { RemitPartnerAllocation } from "./entity/remit_partner_allocations"; -import { RemitRegion } from "./entity/remit_region"; -import { RemitTransfer } from "./entity/remit_tansfer"; -import { RemitTopup } from "./entity/remit_topup"; -import { RemitMutation } from "./entity/remit_mutation"; -import { RemitBank } from "./entity/remit_bank"; -import { RemitConfigTransaction } from "./entity/remit_config_transactions"; -import { RemitConfigAllocation } from "./entity/remit_config_allocations"; -import { RemitConfigKurs } from "./entity/remit_config_kurs"; +import { RemitSender } from "./entity/remit_senders"; +import { RemitTransaction } from "./entity/remit_transactions"; +import { + RemitPartnerType, + RemitPartnerStatus, + RemitRiskLevel, + RemitGender, + RemitIdentityType, + RemitDocumentType, + RemitPartnerFeeType, + RemitSenderType, + RemitTransactionStatus, + RemitTransactionCurrencyType, +} from "./types/remit" import { BrizziBatchStatus, BrizziCardStatus, BrizziHistoryActvity, BrizziHistoryType, BrizziHistoryRemarks } from "./types/brizzi"; import { BrizziBatch } from "./entity/brizzi_batchs"; @@ -208,11 +229,13 @@ export { Application, TellerMutation, LogHikvision, + BrivaCompany, BrivaCompanyUser, BrivaCompanyUserRefreshToken, BrivaAccount, BrivaTransaction, + AssetSupplier, AssetFixedClassification, AssetFixedType, @@ -235,15 +258,7 @@ export { AssetFixedTypeType, AssetInventoryDepreciation, AssetInventoryDepreciationLog, - RemitOtp, - RemitPartnerUser, - RemitPartner, - RemitPartnerTransaction, - RemitPartnerAllocation, - RemitRegion, - RemitTransfer, - RemitTopup, - RemitMutation, + BrizziBatchStatus, BrizziCardStatus, BrizziHistoryActvity, @@ -253,6 +268,7 @@ export { BrizziCard, BrizziHistory, BrizziOldCard, + BrilinkMerchantStatus, BrilinkTerminalType, BrilinkTerminalCondition, @@ -296,13 +312,43 @@ export { BrilinkDiscountStatus, BrilinkDiscountType, BrilinkDiscount, - RemitBank, - RemitConfigTransaction, - RemitConfigAllocation, - RemitConfigKurs, + BriapiConfig, BriapiLog, BriapiAppendixBank, BriapiAppendixWallet, BriapiAppendixId, + + RemitMunisipo, + RemitAdministrativu, + RemitSuco, + RemitAldeia, + RemitPartnerType, + RemitPartnerStatus, + RemitRiskLevel, + RemitGender, + RemitIdentityType, + RemitDocumentType, + RemitPartnerFeeType, + RemitSenderType, + RemitTransactionStatus, + RemitTransactionCurrencyType, + RemitBeneficial, + RemitBeneficiary, + RemitConfigBank, + RemitConfigBusinessType, + RemitConfigKurs, + RemitConfigNationalities, + RemitConfigOccupation, + RemitConfigPurpose, + RemitConfigSourceIncome, + RemitPartnerAccounts, + RemitPartnerApis, + RemitPartnerDocument, + RemitPartnerFee, + RemitPartnerOwners, + RemitPartnerUser, + RemitPartner, + RemitSender, + RemitTransaction }; diff --git a/src/types/remit.ts b/src/types/remit.ts new file mode 100644 index 0000000..173f445 --- /dev/null +++ b/src/types/remit.ts @@ -0,0 +1,61 @@ +export enum RemitPartnerType { + "personal" = "personal", + "company" = "company", +} + +export enum RemitPartnerStatus { + "pending" = "pending", + "approved" = "approved", + "rejected" = "rejected" +} + +export enum RemitRiskLevel { + "low" = "low", + "mid" = "mid", + "high" = "high" +} + +export enum RemitGender { + "man" = "man", + "female" = "female" +} + +export enum RemitIdentityType { + "electoral" = "electoral", + "bilhete de identidade" = "bi", + "passport" = "passport", + "citizen personal id" = "citizen_personal_id", + "driver_license" = "driver_license" +} + +export enum RemitDocumentType { + "electoral" = "electoral", + "bilhete de identidade" = "bi", + "passport" = "passport", + "certificado registo comercial" = "certificado_registo_comercial", + "licenca provisoria" = "licenca_provisoria", + "estatuto" = "estatuto" +} + +export enum RemitPartnerFeeType { + "percentage" = "percentage", + "fix" = "fix" +} + +export enum RemitSenderType { + "bri" = "bri", + "wic" = "wic" +} + +export enum RemitTransactionStatus { + "verify" = "verify", + "reject" = "reject", + "process" = "process", + "success" = "success", + "fail" = "fail", +} + +export enum RemitTransactionCurrencyType { + "rp" = "rp", + "usd" = "usd", +} \ No newline at end of file