diff --git a/src/entity/remit_beneficials.ts b/src/entity/remit_beneficials.ts index de99ede..40ad2c9 100644 --- a/src/entity/remit_beneficials.ts +++ b/src/entity/remit_beneficials.ts @@ -66,19 +66,19 @@ export class RemitBeneficial { @ManyToOne(() => RemitMunisipo, { onDelete: "NO ACTION" }) @JoinColumn() - munisipo: RemitMunisipo + munisipo: RemitMunisipo; @ManyToOne(() => RemitAdministrativu, { onDelete: "NO ACTION" }) @JoinColumn() - administrativu: RemitAdministrativu + administrativu: RemitAdministrativu; @ManyToOne(() => RemitSuco, { onDelete: "NO ACTION" }) @JoinColumn() - suco: RemitSuco + suco: RemitSuco; @ManyToOne(() => RemitAldeia, { onDelete: "NO ACTION" }) @JoinColumn() - aldeia: RemitAldeia + aldeia: RemitAldeia; @ManyToOne(() => RemitConfigNationalities, { onDelete: "NO ACTION", nullable: true }) @JoinColumn() @@ -114,7 +114,7 @@ export class RemitBeneficial { @CreateDateColumn() created_at: Date; - @Column({ nullable: true, length: 256, }) + @Column({ nullable: true, length: 256 }) created_by: string; @Column({ nullable: true }) @@ -130,4 +130,8 @@ export class RemitBeneficial { @Column({ nullable: true, length: 256 }) deleted_by: string; + + @ManyToOne(() => RemitBeneficial, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + parent: RemitBeneficial; } diff --git a/src/entity/remit_beneficiaries.ts b/src/entity/remit_beneficiaries.ts index 866d035..d92dbed 100644 --- a/src/entity/remit_beneficiaries.ts +++ b/src/entity/remit_beneficiaries.ts @@ -12,6 +12,9 @@ import { RemitConfigSourceIncome } from "./remit_config_source_incomes"; import { RemitConfigBank } from "./remit_config_banks"; import { RemitIndoProvince } from "./remit_indo_provinces"; import { RemitIndoCity } from "./remit_indo_cities"; +import { RemitConfigRelation } from "./remit_config_relations"; +import { RemitConfigBusinessType } from "./remit_config_business_types"; +import { RemitConfigBusinessField } from "./remit_config_business_fields"; @Entity("remit_beneficiaries", { schema: "remits" }) export class RemitBeneficiary { @@ -92,4 +95,28 @@ export class RemitBeneficiary { @Column({ nullable: true, length: 256 }) deleted_by: string; + + @ManyToOne(() => RemitBeneficiary, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + parent: RemitBeneficiary; + + @ManyToOne(() => RemitConfigRelation, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + relation: RemitConfigRelation; + + @ManyToOne(() => RemitConfigOccupation, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + occupation: RemitConfigOccupation; + + @ManyToOne(() => RemitConfigBusinessType, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + business_type: RemitConfigBusinessType; + + @ManyToOne(() => RemitConfigBusinessField, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + business_field: RemitConfigBusinessField; + + @ManyToOne(() => RemitConfigNationalities, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + nationality: RemitConfigNationalities; } diff --git a/src/entity/remit_config_transaction_channels.ts b/src/entity/remit_config_transaction_channels.ts new file mode 100644 index 0000000..9357a1b --- /dev/null +++ b/src/entity/remit_config_transaction_channels.ts @@ -0,0 +1,45 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; + +import { Status } from "../types/status"; + +@Entity("remit_config_transaction_channels", { schema: "remits" }) +export class RemitConfigTransactionChannel { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: true, + length: 256, + }) + name: string; + + @Column({ type: "smallint", default: 0 }) + level: Number; + + @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_senders.ts b/src/entity/remit_senders.ts index ef5e69c..d9570a0 100644 --- a/src/entity/remit_senders.ts +++ b/src/entity/remit_senders.ts @@ -15,6 +15,8 @@ import { RemitAdministrativu } from "./remit_administrativus"; import { RemitSuco } from "./remit_sucos"; import { RemitAldeia } from "./remit_aldeias"; import { RemitSenderIdentity } from "./remit_sender_identities"; +import { RemitConfigBusinessType } from "./remit_config_business_types"; +import { RemitConfigBusinessField } from "./remit_config_business_fields"; @Entity("remit_senders", { schema: "remits" }) export class RemitSender { @@ -135,4 +137,16 @@ export class RemitSender { @ManyToMany(() => RemitSenderIdentity, (identity) => identity.sender) sender_identities: RemitSenderIdentity[]; + + @ManyToOne(() => RemitSender, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + parent: RemitSender; + + @ManyToOne(() => RemitConfigBusinessType, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + business_type: RemitConfigBusinessType; + + @ManyToOne(() => RemitConfigBusinessField, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + business_field: RemitConfigBusinessField; } diff --git a/src/entity/remit_transaction_risk.ts b/src/entity/remit_transaction_risk.ts new file mode 100644 index 0000000..8fbc45f --- /dev/null +++ b/src/entity/remit_transaction_risk.ts @@ -0,0 +1,69 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinTable } from "typeorm"; +import { RemitTransaction } from "./remit_transactions"; + +@Entity("remit_transaction_risk", { schema: "remits" }) +export class RemitTransactionRisk { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => RemitTransaction, { onDelete: "RESTRICT" }) + @JoinTable() + transaction: RemitTransaction; + + @Column({ + nullable: true, + length: 256, + }) + category: String; + + @Column({ + nullable: true, + length: 256, + }) + name: String; + + @Column({ + nullable: true, + length: 256, + }) + ref_table: String; + + @Column({ + nullable: true, + length: 256, + }) + ref_id: String; + + @Column({ + nullable: true, + length: 256, + }) + ref_name: String; + + @Column({ + nullable: false, + type: "int2", + }) + ref_value: Number; + + @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_transactions.ts b/src/entity/remit_transactions.ts index 2e3c55c..893ebef 100644 --- a/src/entity/remit_transactions.ts +++ b/src/entity/remit_transactions.ts @@ -1,14 +1,14 @@ -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 { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; import { RemitTransactionCurrencyType, RemitTransactionStatus } from "../types/remit"; import { RemitBeneficial } from "./remit_beneficials"; +import { RemitBeneficiary } from "./remit_beneficiaries"; +import { RemitConfigPurpose } from "./remit_config_purposes"; import { RemitConfigRate } from "./remit_config_rates"; +import { RemitMunisipo } from "./remit_munisipos"; +import { RemitPartner } from "./remit_partners"; +import { RemitSender } from "./remit_senders"; +import { RemitConfigTransactionType } from "./remit_config_transaction_types"; +import { RemitConfigTransactionChannel } from "./remit_config_transaction_channels"; @Entity("remit_transactions", { schema: "remits" }) export class RemitTransaction { @@ -29,11 +29,11 @@ export class RemitTransaction { }) reference: string; - @ManyToOne(() => RemitPartner, { onDelete: "RESTRICT" }) + @ManyToOne(() => RemitPartner, { onDelete: "NO ACTION" }) @JoinTable() partner: RemitPartner; - @ManyToOne(() => RemitSender, { onDelete: "RESTRICT" }) + @ManyToOne(() => RemitSender, { onDelete: "NO ACTION" }) @JoinTable() sender: RemitSender; @@ -41,14 +41,18 @@ export class RemitTransaction { @JoinColumn() benefecial: RemitBeneficial; - @ManyToOne(() => RemitBeneficiary, { onDelete: "RESTRICT" }) + @ManyToOne(() => RemitBeneficiary, { onDelete: "NO ACTION" }) @JoinTable() beneficiary: RemitBeneficiary; - @ManyToOne(() => RemitConfigPurpose, { onDelete: "RESTRICT" }) + @ManyToOne(() => RemitConfigPurpose, { onDelete: "NO ACTION" }) @JoinTable() purpose: RemitConfigPurpose; + @ManyToOne(() => RemitMunisipo, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + munisipo: RemitMunisipo; + @Column({ nullable: true, length: 5, @@ -61,7 +65,7 @@ export class RemitTransaction { }) amount: Number; - @ManyToOne(() => RemitConfigRate, { onDelete: "RESTRICT", nullable: true }) + @ManyToOne(() => RemitConfigRate, { onDelete: "NO ACTION", nullable: true }) @JoinTable() rate: RemitConfigRate; @@ -119,6 +123,12 @@ export class RemitTransaction { }) callback_count: Number; + @Column({ + nullable: true, + type: "float8", + }) + risk_score: Number; + @Column({ nullable: true }) callback_at: Date; @@ -142,4 +152,12 @@ export class RemitTransaction { @Column({ nullable: true, length: 256 }) deleted_by: string; + + @ManyToOne(() => RemitConfigTransactionType, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + transaction_type: RemitConfigTransactionType; + + @ManyToOne(() => RemitConfigTransactionChannel, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + transaction_channel: RemitConfigTransactionChannel; } diff --git a/src/index.ts b/src/index.ts index cfe6d73..889bb79 100644 --- a/src/index.ts +++ b/src/index.ts @@ -119,10 +119,12 @@ import { RemitConfigTransactionType } from "./entity/remit_config_transaction_ty import { RemitConfigChannel } from "./entity/remit_config_channels"; import { RemitConfigTransactionInfo } from "./entity/remit_config_transaction_infos"; import { RemitConfigBoom } from "./entity/remit_config_booms"; +import { RemitConfigTransactionChannel } from "./entity/remit_config_transaction_channels"; import { RemitIndoProvince } from "./entity/remit_indo_provinces"; import { RemitIndoCity } from "./entity/remit_indo_cities"; import { RemitPartnerCallback } from "./entity/remit_partner_callbacks"; import { RemitTransactionPartnerCallbackLog } from "./entity/remit_transaction_partner_callback_logs"; +import { RemitTransactionRisk } from "./entity/remit_transaction_risk"; import { RemitPartnerType, // @@ -411,6 +413,7 @@ export { RemitConfigChannel, RemitConfigTransactionInfo, RemitConfigBoom, + RemitConfigTransactionChannel, RemitPartnerAccounts, RemitPartnerApi, RemitPartnerDocument, @@ -422,6 +425,7 @@ export { RemitSender, RemitSenderIdentity, RemitTransaction, + RemitTransactionRisk, RemitIndoProvince, RemitIndoCity, RemitPartnerCallback,