diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..43962d8 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "printWidth": 5000, + "semi": true, + "singleQuote": false, + "tabWidth": 4, + "useTabs": true +} diff --git a/src/entity/asset_good.ts b/src/entity/asset_good.ts index db84178..c44ca81 100644 --- a/src/entity/asset_good.ts +++ b/src/entity/asset_good.ts @@ -24,7 +24,7 @@ export class AssetGood { @Column({ type: "text", nullable: true }) description: string - @Column({ type: "smallint" }) + @Column({ type: "float8", nullable: false, default: 0 }) price: number @Column({ type: "varchar", length: 50 }) 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/brilink_discounts.ts b/src/entity/brilink_discounts.ts new file mode 100644 index 0000000..d6032e1 --- /dev/null +++ b/src/entity/brilink_discounts.ts @@ -0,0 +1,63 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'; + +import { BrilinkDiscountModule, BrilinkDiscountStatus, BrilinkDiscountType } from '../types/brilink'; +import { BrilinkMerchant } from './brilink_merchants'; + +@Entity('brilink_discounts', { schema: 'brilinks' }) +export class BrilinkDiscount { + @PrimaryGeneratedColumn('uuid') + id: string; + + @ManyToOne(() => BrilinkMerchant, { onDelete: 'RESTRICT' }) + @JoinTable() + merchant: BrilinkMerchant + + @Column({ type: "varchar", length: 255 }) + module: BrilinkDiscountModule; + + @Column({ type: "varchar", length: 255, unique: true }) + code: string; + + @Column({ type: "varchar", length: 255 }) + name: string; + + @Column({ type: "varchar", length: 255 }) + type: BrilinkDiscountType; + + @Column({ + type: 'float8', + nullable: false, + default: 0 + }) + amount: number; + + @Column({ nullable: false }) + start_date: Date; + + @Column({ nullable: false }) + end_date: Date; + + @Column({ type: "varchar", length: 10 }) + status: BrilinkDiscountStatus; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ type: "varchar", length: 255 }) + created_by: string; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + updated_by: string; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + deleted_by: string; +} \ No newline at end of file diff --git a/src/entity/brilink_merchant_product_items.ts b/src/entity/brilink_merchant_product_items.ts new file mode 100644 index 0000000..8acc1f0 --- /dev/null +++ b/src/entity/brilink_merchant_product_items.ts @@ -0,0 +1,54 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { Status } from "../types/status"; +import { BrilinkProductCategory } from "./brilink_product_categories"; +import { BrilinkProductItem } from "./brilink_product_items"; +import { BrilinkMerchant } from "./brilink_merchants"; + +@Entity("brilink_merchant_product_items", { schema: "brilinks" }) +export class BrilinkMerchantProductItem { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => BrilinkMerchant, { onDelete: "RESTRICT" }) + @JoinTable() + merchant: BrilinkMerchant; + + @ManyToOne(() => BrilinkProductItem, { onDelete: "RESTRICT" }) + @JoinTable() + product_item: BrilinkProductItem; + + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + price_merchant: number; + + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + price_sale: number; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ type: "varchar", length: 255 }) + created_by: string; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + updated_by: string; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + deleted_by: string; +} diff --git a/src/entity/brilink_merchant_settlements.ts b/src/entity/brilink_merchant_settlements.ts index cfde6f3..4033d17 100644 --- a/src/entity/brilink_merchant_settlements.ts +++ b/src/entity/brilink_merchant_settlements.ts @@ -24,6 +24,13 @@ export class BrilinkMerchantSettlement { }) amount: number; + @Column({ + type: 'float8', + nullable: false, + default: 0 + }) + discount: number; + @Column({ type: 'float8', nullable: false, diff --git a/src/entity/brilink_product_categories.ts b/src/entity/brilink_product_categories.ts new file mode 100644 index 0000000..7b5e16a --- /dev/null +++ b/src/entity/brilink_product_categories.ts @@ -0,0 +1,74 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { BrilinkProductCategorySupplier } from "../types/brilink"; +import { BrilinkTerminalMenu } from "./brilink_terminal_menus"; +import { Status } from "../types/status"; + +@Entity("brilink_product_categories", { schema: "brilinks" }) +export class BrilinkProductCategory { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => BrilinkTerminalMenu, { onDelete: "NO ACTION" }) + @JoinTable() + terminal_menu: BrilinkTerminalMenu; + + @Column({ + nullable: false, + length: 128, + unique: true, + }) + code: string; + + @Column({ + nullable: false, + length: 128, + }) + name: string; + + @Column({ + nullable: false, + length: 4096, + default: "", + }) + description: string; + + @Column({ + nullable: false, + length: 4096, + default: "", + }) + logo: string; + + @Column({ + nullable: false, + length: 64, + }) + status: Status; + + @Column({ + nullable: false, + length: 64, + }) + supplier: BrilinkProductCategorySupplier; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ type: "varchar", length: 255 }) + created_by: string; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + updated_by: string; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + deleted_by: string; +} diff --git a/src/entity/brilink_product_items.ts b/src/entity/brilink_product_items.ts new file mode 100644 index 0000000..0d3064a --- /dev/null +++ b/src/entity/brilink_product_items.ts @@ -0,0 +1,95 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { Status } from "../types/status"; +import { BrilinkProductCategory } from "./brilink_product_categories"; +import { BrilinkProductType } from "./brilink_product_types"; + +@Entity("brilink_product_items", { schema: "brilinks" }) +export class BrilinkProductItem { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => BrilinkProductType, { onDelete: "RESTRICT" }) + @JoinTable() + product_type: BrilinkProductType; + + @Column({ + nullable: false, + length: 128, + unique: true, + }) + code: string; + + @Column({ + nullable: false, + length: 128, + }) + name: string; + + @Column({ + nullable: false, + length: 128, + default: "", + }) + subtitle: string; + + @Column({ + nullable: false, + length: 4096, + default: "", + }) + description: string; + + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + price_base: number; + + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + price_merchant: number; + + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + price_sale: number; + + @Column({ + nullable: false, + length: 64, + }) + status: Status; + + @Column({ + type: "jsonb", + nullable: true, + }) + supplier_prop: Record; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ type: "varchar", length: 255 }) + created_by: string; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + updated_by: string; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + deleted_by: string; +} diff --git a/src/entity/brilink_product_types.ts b/src/entity/brilink_product_types.ts new file mode 100644 index 0000000..37f502f --- /dev/null +++ b/src/entity/brilink_product_types.ts @@ -0,0 +1,62 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { BrilinkProductCategorySupplier } from "../types/brilink"; +import { BrilinkTerminalMenu } from "./brilink_terminal_menus"; +import { Status } from "../types/status"; +import { BrilinkProductCategory } from "./brilink_product_categories"; + +@Entity("brilink_product_types", { schema: "brilinks" }) +export class BrilinkProductType { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => BrilinkProductCategory, { onDelete: "RESTRICT" }) + @JoinTable() + product_category: BrilinkProductCategory; + + @Column({ + nullable: false, + length: 128, + unique: true, + }) + code: string; + + @Column({ + nullable: false, + length: 128, + }) + name: string; + + @Column({ + nullable: false, + length: 4096, + default: "", + }) + description: string; + + @Column({ + nullable: false, + length: 64, + }) + status: Status; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ type: "varchar", length: 255 }) + created_by: string; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + updated_by: string; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + deleted_by: string; +} diff --git a/src/entity/brilink_transactions.ts b/src/entity/brilink_transactions.ts index a6a82c9..082ca34 100644 --- a/src/entity/brilink_transactions.ts +++ b/src/entity/brilink_transactions.ts @@ -1,129 +1,163 @@ -import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'; -import { BrilinkMerchant } from './brilink_merchants'; -import { BrilinkBalanceCode, BrilinkBalanceType, BrilinkTransactionActivity, BrilinkTransactionStatus, BrilinkTransactionType } from '../types/brilink'; -import { BrilinkMerchantTerminal } from './brilink_merchant_terminals'; -import { BrilinkTerminal } from './brilink_terminals'; -import { BrilinkBalance } from './brilink_balances.ts'; -import { BrilinkBalanceMutation } from './brilink_balance_mutations'; -import { BrilinkMerchantSettlement } from './brilink_merchant_settlements'; +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { BrilinkMerchant } from "./brilink_merchants"; +import { BrilinkBalanceCode, BrilinkBalanceType, BrilinkTransactionActivity, BrilinkTransactionStatus, BrilinkTransactionType } from "../types/brilink"; +import { BrilinkMerchantTerminal } from "./brilink_merchant_terminals"; +import { BrilinkTerminal } from "./brilink_terminals"; +import { BrilinkBalance } from "./brilink_balances.ts"; +import { BrilinkBalanceMutation } from "./brilink_balance_mutations"; +import { BrilinkMerchantSettlement } from "./brilink_merchant_settlements"; +import { BrilinkDiscount } from "./brilink_discounts"; +import { BrilinkProductItem } from "./brilink_product_items"; -@Entity('brilink_transactions', { schema: 'brilinks' }) +@Entity("brilink_transactions", { schema: "brilinks" }) export class BrilinkTransaction { - @PrimaryGeneratedColumn('uuid') - id: string; + @PrimaryGeneratedColumn("uuid") + id: string; - @ManyToOne(() => BrilinkMerchant, { onDelete: 'RESTRICT' }) - @JoinTable() - merchant: BrilinkMerchant + @ManyToOne(() => BrilinkMerchant, { onDelete: "RESTRICT" }) + @JoinTable() + merchant: BrilinkMerchant; - @ManyToOne(() => BrilinkMerchantTerminal, { onDelete: 'RESTRICT' }) - @JoinTable() - merchant_terminal: BrilinkMerchantTerminal + @ManyToOne(() => BrilinkMerchantTerminal, { onDelete: "RESTRICT" }) + @JoinTable() + merchant_terminal: BrilinkMerchantTerminal; - @ManyToOne(() => BrilinkBalanceMutation, { onDelete: 'RESTRICT', nullable: true }) - @JoinTable() - balance_mutation: BrilinkBalanceMutation + @ManyToOne(() => BrilinkBalanceMutation, { onDelete: "RESTRICT", nullable: true }) + @JoinTable() + balance_mutation: BrilinkBalanceMutation; - @Column({ - nullable: false, - length: 128 - }) - code: string; + @Column({ + nullable: false, + length: 128, + }) + code: string; - @Column({ - nullable: false, - length: 64 - }) - type: BrilinkTransactionType + @Column({ + nullable: false, + length: 64, + }) + type: BrilinkTransactionType; - @Column({ - nullable: false, - length: 64 - }) - activity: BrilinkTransactionActivity; + @Column({ + nullable: false, + length: 64, + }) + activity: BrilinkTransactionActivity; - @Column({ nullable: false }) - activity_at: Date; + @Column({ nullable: false }) + activity_at: Date; - @Column({ - length: 128, - nullable: true, - }) - target: string; + @Column({ + length: 128, + nullable: true, + }) + target: string; - @Column({ - type: 'jsonb', - nullable: true, - }) - target_data: Record; + @Column({ + type: "jsonb", + nullable: true, + }) + target_data: Record; - @Column({ - type: 'float8', - nullable: false, - default: 0 - }) - amount: number; + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + amount: number; - @Column({ - type: 'float8', - nullable: false, - default: 0 - }) - fee: number; + @ManyToOne(() => BrilinkDiscount, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + discount: BrilinkDiscount; - @Column({ - type: 'float8', - nullable: false, - default: 0 - }) - total: number; + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + discount_amount: number; - @Column({ - nullable: false, - length: 64 - }) - status: BrilinkTransactionStatus; + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + fee: number; - @Column({ - length: 128, - nullable: true, - }) - reference: string; + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + total: number; - @Column({ - length: 1024, - nullable: true, - }) - remarks: string; + @Column({ + nullable: false, + length: 64, + }) + status: BrilinkTransactionStatus; - @Column({ - nullable: false, - default: false - }) - is_merchant_settlement: boolean; + @Column({ + length: 128, + nullable: true, + }) + reference: string; - @ManyToOne(() => BrilinkMerchantSettlement, { onDelete: 'RESTRICT', nullable: true }) - @JoinTable() - merchant_settlement: BrilinkMerchantSettlement + @Column({ + length: 1024, + nullable: true, + }) + remarks: string; - @Column() - @CreateDateColumn() - created_at: Date; + @Column({ + nullable: false, + default: false, + }) + is_merchant_settlement: boolean; - @Column({ type: "varchar", length: 255 }) - created_by: string; + @ManyToOne(() => BrilinkMerchantSettlement, { onDelete: "RESTRICT", nullable: true }) + @JoinTable() + merchant_settlement: BrilinkMerchantSettlement; - @Column({ nullable: true }) - @UpdateDateColumn() - updated_at: Date; + @ManyToOne(() => BrilinkProductItem, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + product_item: BrilinkProductItem; - @Column({ type: "varchar", length: 255, nullable: true }) - updated_by: string; + @Column({ + length: 128, + nullable: true, + }) + supplier_reference_code: string; - @Column({ nullable: true }) - @DeleteDateColumn() - deleted_at: Date; + @Column({ + length: 128, + nullable: true, + }) + supplier_transaction_code: string; - @Column({ type: "varchar", length: 255, nullable: true }) - deleted_by: string; -} \ No newline at end of file + @Column({ + default: 0, + }) + supplier_check: number; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ type: "varchar", length: 255 }) + created_by: string; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + updated_by: string; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + deleted_by: 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_config_kurs.ts b/src/entity/remit_config_business_types.ts similarity index 62% rename from src/entity/remit_config_kurs.ts rename to src/entity/remit_config_business_types.ts index b723941..9df5bfc 100644 --- a/src/entity/remit_config_kurs.ts +++ b/src/entity/remit_config_business_types.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_kurs", { schema: "remits" }) -export class RemitConfigKurs { +@Entity("remit_config_business_types", { schema: "remits" }) +export class RemitConfigBusinessType { @PrimaryGeneratedColumn("uuid") id: string; @@ -11,7 +12,13 @@ export class RemitConfigKurs { nullable: true, length: 256, }) - value: string; + name: string; + + @Column({ + nullable: false, + length: 64, + }) + level: RemitRiskLevel; @Column({ nullable: false, @@ -23,23 +30,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_config_rates.ts b/src/entity/remit_config_rates.ts new file mode 100644 index 0000000..b6ca04d --- /dev/null +++ b/src/entity/remit_config_rates.ts @@ -0,0 +1,54 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm" + +import { Status } from "../types/status" + +@Entity("remit_config_rates", { schema: "remits" }) +export class RemitConfigRate { + @PrimaryGeneratedColumn("uuid") + id: string + + @Column({ + nullable: true, + length: 256, + }) + from: string + + @Column({ + nullable: true, + length: 256, + }) + to: string + + @Column({ + nullable: true, + length: 256, + }) + value: string + + @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_partner_allocations.ts b/src/entity/remit_config_source_incomes.ts similarity index 56% rename from src/entity/remit_partner_allocations.ts rename to src/entity/remit_config_source_incomes.ts index aec974d..046b8f4 100644 --- a/src/entity/remit_partner_allocations.ts +++ b/src/entity/remit_config_source_incomes.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_source_incomes", { schema: "remits" }) +export class RemitConfigSourceIncome { @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_otp.ts b/src/entity/remit_munisipos.ts similarity index 51% rename from src/entity/remit_otp.ts rename to src/entity/remit_munisipos.ts index 213e6bb..37cc7ac 100644 --- a/src/entity/remit_otp.ts +++ b/src/entity/remit_munisipos.ts @@ -1,36 +1,35 @@ -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_otp", { schema: "remits" }) -export class RemitOtp { +@Entity("remit_munisipos", { schema: "remits" }) +export class RemitMunisipo { @PrimaryGeneratedColumn("uuid") id: string; @Column({ - nullable: false, + nullable: true, length: 256, }) - username: string; - - @Column({ - nullable: false, - length: 256, - }) - otp: string; - - @Column("timestamp") - expired_at: Date; + 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..aa84794 --- /dev/null +++ b/src/entity/remit_partner_apis.ts @@ -0,0 +1,56 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { RemitPartner } from "./remit_partners"; + +@Entity("remit_partner_apis", { schema: "remits" }) +export class RemitPartnerApi { + @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({ + nullable: true, + length: 256, + }) + token: string; + + @Column({ + nullable: true, + }) + expires_in: Date; + + @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_user_refresh_token.ts b/src/entity/remit_partner_user_refresh_token.ts new file mode 100644 index 0000000..44b12f4 --- /dev/null +++ b/src/entity/remit_partner_user_refresh_token.ts @@ -0,0 +1,64 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from "typeorm" + +@Entity("remit_partner_user_refresh_tokens") +export class RemitPartnerUserRefreshToken { + @PrimaryGeneratedColumn("uuid") + refresh_token: string + + @Index() + @Column({ + type: "uuid", + }) + id_user: string + + @Column({ + nullable: false, + length: 4096, + }) + user_agent: string + + @Column({ + nullable: true, + length: 128, + }) + os: string + + @Column({ + nullable: true, + length: 256, + }) + device: string + + @Column({ + nullable: true, + length: 64, + }) + platform: string + + @Column({ + nullable: true, + length: 64, + }) + browser: string + + @Column({ + nullable: true, + length: 32, + }) + remote_addr: string + + @Column("timestamp") + expired_at: Date + + @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_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_sender_identities.ts b/src/entity/remit_sender_identities.ts new file mode 100644 index 0000000..0ed8d63 --- /dev/null +++ b/src/entity/remit_sender_identities.ts @@ -0,0 +1,72 @@ +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"; +import { RemitSender } from "./remit_senders"; + +@Entity("remit_sender_identities", { schema: "remits" }) +export class RemitSenderIdentity { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => RemitSender, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + sender: RemitSender; + + @Column({ + nullable: true, + length: 256, + }) + type: RemitIdentityType; + + @Column({ + nullable: true, + length: 256, + }) + number: string; + + @Column({ + nullable: true, + length: 256, + }) + issued_place: string; + + @Column({ + nullable: true, + length: 256, + }) + expired_at: 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_senders.ts b/src/entity/remit_senders.ts new file mode 100644 index 0000000..c457923 --- /dev/null +++ b/src/entity/remit_senders.ts @@ -0,0 +1,134 @@ +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() + @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..3b6923f --- /dev/null +++ b/src/entity/remit_transactions.ts @@ -0,0 +1,118 @@ +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"; +import { RemitConfigRate } from "./remit_config_rates"; + +@Entity("remit_transactions", { schema: "remits" }) +export class RemitTransaction { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + unique: true, + length: 256, + }) + code: string; + + @Column({ + nullable: false, + unique: true, + length: 256, + }) + reference: 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; + + @ManyToOne(() => RemitConfigRate, { onDelete: "RESTRICT", nullable: true }) + @JoinTable() + rate: RemitConfigRate; + + @Column({ + nullable: true, + type: "float8", + }) + total: 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/entity/tcel_configs.ts b/src/entity/tcel_configs.ts new file mode 100644 index 0000000..c43bbc7 --- /dev/null +++ b/src/entity/tcel_configs.ts @@ -0,0 +1,28 @@ +import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; + +@Entity("tcel_configs", { schema: "tcel" }) +export class TcelConfig { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + length: 4096, + }) + key: string; + + @Column({ + length: 4096, + }) + value: string; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true }) + expired_at: Date; +} diff --git a/src/entity/tcel_logs.ts b/src/entity/tcel_logs.ts new file mode 100644 index 0000000..c2e1aba --- /dev/null +++ b/src/entity/tcel_logs.ts @@ -0,0 +1,54 @@ +import { Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm"; +import { Application } from "./application"; + +@Entity("tcel_logs", { schema: "tcel" }) +export class TcelLog { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => Application, { onDelete: "NO ACTION" }) + @JoinColumn({ name: "application" }) + application: Application; + + @Column({ + length: 256, + }) + url: string; + + @Column({ + type: "jsonb", + }) + header: string; + + @Column({ + type: "jsonb", + }) + body: string; + + @Column() + request_at: Date; + + @Column({ + length: 4096, + }) + response: string; + + @Column({ + length: 128, + nullable: true, + }) + supplier_reference_code: string; + + @Column({ + length: 128, + nullable: true, + }) + supplier_transaction_code: string; + + @Column() + response_at: Date; + + @Column() + @CreateDateColumn() + created_at: Date; +} diff --git a/src/index.ts b/src/index.ts index d6b8b41..3e9d760 100644 --- a/src/index.ts +++ b/src/index.ts @@ -84,26 +84,82 @@ 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 { RemitConfigRate } from "./entity/remit_config_rates"; +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 { RemitPartnerApi } 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 { RemitPartnerUserRefreshToken } from "./entity/remit_partner_user_refresh_token"; 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 { RemitSenderIdentity } from "./entity/remit_sender_identities"; +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 { BrizziBatchStatus, BrizziCardStatus, BrizziHistoryActvity, BrizziHistoryType, BrizziHistoryRemarks } from "./types/brizzi"; import { BrizziBatch } from "./entity/brizzi_batchs"; import { BrizziCard } from "./entity/brizzi_cards"; import { BrizziHistory } from "./entity/brizzi_history"; import { BrizziOldCard } from "./entity/brizzi_old_card"; -import { BrilinkMerchantStatus, BrilinkTerminalType, BrilinkTerminalCondition, BrilinkTerminalOnline, BrilinkBalanceType, BrilinkBalanceCode, BrilinkBalanceMutationType, BrilinkBalanceMutationActvity, BrilinkBalanceSourceType, BrilinkBalanceDestinationType, BrilinkBalanceMutationStatus, BrilinkTransactionType, BrilinkTransactionActivity, BrilinkTransactionStatus, BrilinkMerchantSettlementStatus, BrilinkTransactionCodePrefixType, BrilinkTransactionCodePrefixActivity, BrilinkBalanceMutationCodePrefixType, BrilinkBalanceMutationCodePrefixActvity, BrilinkBalanceTopupCodePrefix } from "./types/brilink"; +import { + BrilinkMerchantStatus, // + BrilinkTerminalType, + BrilinkTerminalCondition, + BrilinkTerminalOnline, + BrilinkBalanceType, + BrilinkBalanceCode, + BrilinkBalanceMutationType, + BrilinkBalanceMutationActvity, + BrilinkBalanceSourceType, + BrilinkBalanceDestinationType, + BrilinkBalanceMutationStatus, + BrilinkTransactionType, + BrilinkTransactionActivity, + BrilinkTransactionStatus, + BrilinkMerchantSettlementStatus, + BrilinkTransactionCodePrefixType, + BrilinkTransactionCodePrefixActivity, + BrilinkBalanceMutationCodePrefixType, + BrilinkBalanceMutationCodePrefixActvity, + BrilinkBalanceTopupCodePrefix, + BrilinkDiscountModule, + BrilinkDiscountStatus, + BrilinkDiscountType, + BrilinkProductCategorySupplier, +} from "./types/brilink"; import { BrilinkMerchant } from "./entity/brilink_merchants"; import { BrilinkMerchantUser } from "./entity/brilink_merchant_users"; @@ -124,6 +180,11 @@ import { BrilinkTransaction } from "./entity/brilink_transactions"; import { BrilinkMerchantSettlement } from "./entity/brilink_merchant_settlements"; import { BrilinkMembership } from "./entity/brilink_memberships"; import { BrilinkMembershipCard } from "./entity/brilink_membership_cards"; +import { BrilinkDiscount } from "./entity/brilink_discounts"; +import { BrilinkProductCategory } from "./entity/brilink_product_categories"; +import { BrilinkProductType } from "./entity/brilink_product_types"; +import { BrilinkProductItem } from "./entity/brilink_product_items"; +import { BrilinkMerchantProductItem } from "./entity/brilink_merchant_product_items"; import { BriapiConfig } from "./entity/briapi_configs"; import { BriapiLog } from "./entity/briapi_logs"; @@ -131,6 +192,9 @@ import { BriapiAppendixBank } from "./entity/briapi_appendix_banks"; import { BriapiAppendixWallet } from "./entity/briapi_appendix_wallets"; import { BriapiAppendixId } from "./entity/briapi_appendix_ids"; +import { TcelLog } from "./entity/tcel_logs"; +import { TcelConfig } from "./entity/tcel_configs"; + export { User, // UserRole, @@ -224,15 +288,6 @@ export { AssetFixedTypeType, AssetInventoryDepreciation, AssetInventoryDepreciationLog, - RemitOtp, - RemitPartnerUser, - RemitPartner, - RemitPartnerTransaction, - RemitPartnerAllocation, - RemitRegion, - RemitTransfer, - RemitTopup, - RemitMutation, BrizziBatchStatus, BrizziCardStatus, BrizziHistoryActvity, @@ -281,13 +336,54 @@ export { BrilinkBalanceTopupCodePrefix, BrilinkMembership, BrilinkMembershipCard, - RemitBank, - RemitConfigTransaction, - RemitConfigAllocation, - RemitConfigKurs, + BrilinkDiscountModule, + BrilinkDiscountStatus, + BrilinkDiscountType, + BrilinkDiscount, + BrilinkProductCategorySupplier, + BrilinkProductCategory, + BrilinkProductType, + BrilinkProductItem, + BrilinkMerchantProductItem, BriapiConfig, BriapiLog, BriapiAppendixBank, BriapiAppendixWallet, BriapiAppendixId, + RemitMunisipo, + RemitAdministrativu, + RemitSuco, + RemitAldeia, + RemitPartnerType, + RemitPartnerStatus, + RemitRiskLevel, + RemitGender, + RemitIdentityType, + RemitDocumentType, + RemitPartnerFeeType, + RemitSenderType, + RemitTransactionStatus, + RemitTransactionCurrencyType, + RemitBeneficial, + RemitBeneficiary, + RemitConfigBank, + RemitConfigBusinessType, + RemitConfigRate, + RemitConfigNationalities, + RemitConfigOccupation, + RemitConfigPurpose, + RemitConfigSourceIncome, + RemitPartnerAccounts, + RemitPartnerApi, + RemitPartnerDocument, + RemitPartnerFee, + RemitPartnerOwners, + RemitPartnerUser, + RemitPartnerUserRefreshToken, + RemitPartner, + RemitSender, + RemitSenderIdentity, + RemitTransaction, + TcelConfig, + TcelLog, }; diff --git a/src/types/brilink.ts b/src/types/brilink.ts index 7dd7d87..c5c5222 100644 --- a/src/types/brilink.ts +++ b/src/types/brilink.ts @@ -1,120 +1,144 @@ export enum BrilinkMerchantStatus { - "active" = "active", - "inactive" = "inactive", -}; + "active" = "active", + "inactive" = "inactive", +} export enum BrilinkTerminalType { - "edc" = "edc", -}; + "edc" = "edc", +} export enum BrilinkTerminalCondition { - "new" = "new", - "good" = "good", - "minor_damage" = "minor_damage", - "damaged" = "damaged", - "unusabel" = "unusable", - "disposed" = "disposed", - "lost" = "lost", -}; + "new" = "new", + "good" = "good", + "minor_damage" = "minor_damage", + "damaged" = "damaged", + "unusabel" = "unusable", + "disposed" = "disposed", + "lost" = "lost", +} export enum BrilinkTerminalOnline { - "online" = "online", - "offline" = "offline", - "block" = "block" + "online" = "online", + "offline" = "offline", + "block" = "block", } export enum BrilinkBalanceType { - "merchant" = "merchant", - "terminal" = "terminal" + "merchant" = "merchant", + "terminal" = "terminal", } export enum BrilinkBalanceCode { - "brizzi" = "brizzi", - "remittance" = "remittance" + "brizzi" = "brizzi", + "remittance" = "remittance", } export enum BrilinkBalanceMutationType { - "credit" = "credit", - "debit" = "debit", + "credit" = "credit", + "debit" = "debit", } export enum BrilinkBalanceMutationCodePrefixType { - "credit" = "CR", - "debit" = "DB" + "credit" = "CR", + "debit" = "DB", } export enum BrilinkBalanceMutationActvity { - "topup" = "topup", - "transfer" = "transfer", - "withdrawal" = "withdrawal", + "topup" = "topup", + "transfer" = "transfer", + "withdrawal" = "withdrawal", } export enum BrilinkBalanceMutationCodePrefixActvity { - "topup" = "1", - "transfer" = "2", - "withdrawal" = "3" + "topup" = "1", + "transfer" = "2", + "withdrawal" = "3", } export enum BrilinkBalanceSourceType { - "account" = "account", - "merchant" = "merchant", - "terminal" = "terminal", + "account" = "account", + "merchant" = "merchant", + "terminal" = "terminal", } export enum BrilinkBalanceDestinationType { - "account" = "account", - "merchant" = "merchant", - "terminal" = "terminal", - "brizzi" = "brizzi" + "account" = "account", + "merchant" = "merchant", + "terminal" = "terminal", + "brizzi" = "brizzi", } export enum BrilinkBalanceMutationStatus { - "pending" = "pending", - "process" = "process", - "success" = "success", - "fail" = "fail", - "reject" = "reject" + "pending" = "pending", + "process" = "process", + "success" = "success", + "fail" = "fail", + "reject" = "reject", } export enum BrilinkBalanceTopupCodePrefix { - "account" = "ACC", - "merchant" = "MCH", - "terminal" = "TML", - "brizzi" = "BRZ" + "account" = "ACC", + "merchant" = "MCH", + "terminal" = "TML", + "brizzi" = "BRZ", } export enum BrilinkTransactionType { - "brizzi" = "brizzi", - "remittance" = "remittance" + "brizzi" = "brizzi", + "remittance" = "remittance", + "mobile" = "mobile", } export enum BrilinkTransactionCodePrefixType { - "brizzi" = "BRZ", - "remittance" = "RTC" + "brizzi" = "BRZ", + "remittance" = "RTC", + "mobile" = "MBL", } export enum BrilinkTransactionActivity { - "topup" = "topup", - "payment" = "payment", - "purchase" = "purchase" + "topup" = "topup", + "payment" = "payment", + "purchase" = "purchase", } export enum BrilinkTransactionCodePrefixActivity { - "topup" = "1", - "payment" = "2", - "purchase" = "3" + "topup" = "1", + "payment" = "2", + "purchase" = "3", } export enum BrilinkTransactionStatus { - "pending" = "pending", - "process" = "process", - "success" = "success", - "fail" = "fail", + "unpaid" = "unpaid", + "paid" = "paid", + "pending" = "pending", + "process" = "process", + "success" = "success", + "fail" = "fail", } export enum BrilinkMerchantSettlementStatus { - "pending" = "pending", - "process" = "process", - "success" = "success", - "fail" = "fail", + "pending" = "pending", + "process" = "process", + "success" = "success", + "fail" = "fail", +} + +export enum BrilinkDiscountType { + "fix" = "fix", + "percentage" = "percentage", +} + +export enum BrilinkDiscountStatus { + "scheduled" = "scheduled", + "active" = "active", + "inactive" = "inactive", + "expired" = "expired", +} + +export enum BrilinkDiscountModule { + "brizzi" = "brizzi", +} + +export enum BrilinkProductCategorySupplier { + "tcel" = "tcel", } diff --git a/src/types/remit.ts b/src/types/remit.ts new file mode 100644 index 0000000..7d3319a --- /dev/null +++ b/src/types/remit.ts @@ -0,0 +1,62 @@ +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", + "bi" = "bi", + "passport" = "passport", + "visa" = "visa", + "citizen personal id" = "citizen_personal_id", + "driver_license" = "driver_license" +} + +export enum RemitDocumentType { + "electoral" = "electoral", + "bi" = "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