From 1601e509b9529b343204040e0e19899f662a54a4 Mon Sep 17 00:00:00 2001 From: meusinfirmary Date: Sun, 16 Mar 2025 01:25:18 +0700 Subject: [PATCH] update remitance --- src/entity/remit_otp.ts | 36 +++++++ src/entity/remit_partner_users.ts | 78 +++++++++++++++ src/entity/remit_partners.ts | 152 ++++++++++++++++++++++++++++++ src/index.ts | 48 +++++----- 4 files changed, 293 insertions(+), 21 deletions(-) create mode 100644 src/entity/remit_otp.ts create mode 100644 src/entity/remit_partner_users.ts create mode 100644 src/entity/remit_partners.ts diff --git a/src/entity/remit_otp.ts b/src/entity/remit_otp.ts new file mode 100644 index 0000000..459b60e --- /dev/null +++ b/src/entity/remit_otp.ts @@ -0,0 +1,36 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm"; + +import { Status } from "../types/status"; + +@Entity("remit_otp", { schema: "remit" }) +export class RemitOtp { + @Column({ + nullable: false, + length: 256, + }) + phone: string; + + @Column({ + nullable: false, + length: 256, + }) + otp: string; + + @Column({ + nullable: false, + length: 256, + }) + 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 new file mode 100644 index 0000000..be3161b --- /dev/null +++ b/src/entity/remit_partner_users.ts @@ -0,0 +1,78 @@ +import bcrypt from "bcryptjs"; +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, OneToOne, JoinColumn, ManyToOne, OneToMany, ManyToMany, JoinTable } from "typeorm"; + +import { Status } from "../types/status"; + +import { RemitPartner } from "./remit_partners"; + +@Entity("remit_partner_users", { schema: "remit" }) +export class RemitPartnerUser { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + unique: false, + length: 64, + }) + email: string; + + @Column({ + nullable: false, + length: 64, + select: false, + }) + password: string; + + @Column({ + nullable: false, + unique: false, + length: 64, + }) + username: string; + + @Column({ + nullable: true, + length: 64, + unique: false, + }) + name: string; + + @ManyToOne(() => RemitPartner, { onDelete: "CASCADE" }) + @JoinTable() + partner: RemitPartner; + + @Index() + @Column({ + nullable: true, + type: "uuid", + select: false, + }) + reset_token: string; + + @Column({ + nullable: false, + length: 64, + }) + status: Status; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + hashPassword() { + this.password = bcrypt.hashSync(this.password, 8); + } + + checkIfPasswordMatch(unencryptedPassword: string) { + return bcrypt.compareSync(unencryptedPassword, this.password); + } +} diff --git a/src/entity/remit_partners.ts b/src/entity/remit_partners.ts new file mode 100644 index 0000000..d21cc52 --- /dev/null +++ b/src/entity/remit_partners.ts @@ -0,0 +1,152 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm"; + +import { Status } from "../types/status"; + +@Entity("remit_partners", { schema: "remit" }) +export class RemitPartner { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + unique: true, + length: 256, + }) + code: string; + + @Column({ + nullable: false, + unique: true, + length: 256, + }) + name: string; + + @Column({ + nullable: false, + unique: false, + length: 256, + }) + phone: string; + + @Column({ + nullable: true, + length: 4096, + }) + address: string; + + @Column({ + nullable: false, + unique: false, + length: 256, + }) + municipio_id: string; + + @Column({ + nullable: false, + unique: false, + length: 256, + }) + municipio_name: string; + + @Column({ + nullable: false, + unique: false, + length: 256, + }) + posto_adm_id: string; + + @Column({ + nullable: false, + unique: false, + length: 256, + }) + posto_adm_name: string; + + @Column({ + nullable: false, + unique: false, + length: 256, + }) + suco_id: string; + + @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: false, + unique: false, + length: 256, + }) + account_number_tl: string; + + @Column({ + nullable: false, + unique: false, + length: 256, + }) + account_name_tl: string; + + @Column({ + nullable: false, + unique: false, + length: 256, + }) + pin: string; + + @Column({ + nullable: false, + length: 64, + }) + status: Status; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; +} diff --git a/src/index.ts b/src/index.ts index ba2a1e2..861b4c7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -53,26 +53,29 @@ import { CreditConfigInsurance } from "./entity/credit_config_insurance"; import { Application } from "./entity/application"; import { TellerMutation } from "./entity/teller_mutation"; import { LogHikvision } from "./entity/log_hikvision"; -import { BrivaCompany } from "./entity/briva_companies" -import { BrivaCompanyUser } from "./entity/briva_company_users" -import { BrivaCompanyUserRefreshToken } from "./entity/briva_company_user_refresh_token" -import { BrivaAccount } from './entity/briva_accounts' -import { BrivaTransaction } from './entity/briva_transactions' -import { AssetSupplier } from './entity/asset_supplier' -import { AssetFixedClassification } from './entity/asset_fixed_classification' -import { AssetFixedType } from './entity/asset_fixed_type' -import { AssetGoodCategory } from './entity/asset_good_category' -import { AssetGood } from './entity/asset_good' -import { AssetRequestOrderCategory } from './entity/asset_request_order_category' -import { AssetRequestOrder } from './entity/asset_request_order' -import { AssetRequestOrderGood } from './entity/asset_request_order_good' -import { AssetPurchase } from './entity/asset_purchase' -import { AssetPurchaseRequestOrder } from './entity/asset_purchase_request_order' -import { AssetPurchaseGoodsReceipt } from './entity/asset_purchase_goods_receipt' -import { AssetPurchaseGoodReceiptGood } from './entity/asset_purchase_goods_receipt_good' -import { AssetPurchaseRealization } from './entity/asset_purchase_realization' -import { AssetPurchaseBondRealizationGood } from './entity/asset_purchase_purchase_bond_realization_good' -import { AssetPurchaseInvoice } from './entity/asset_purchase_invoice' +import { BrivaCompany } from "./entity/briva_companies"; +import { BrivaCompanyUser } from "./entity/briva_company_users"; +import { BrivaCompanyUserRefreshToken } from "./entity/briva_company_user_refresh_token"; +import { BrivaAccount } from "./entity/briva_accounts"; +import { BrivaTransaction } from "./entity/briva_transactions"; +import { AssetSupplier } from "./entity/asset_supplier"; +import { AssetFixedClassification } from "./entity/asset_fixed_classification"; +import { AssetFixedType } from "./entity/asset_fixed_type"; +import { AssetGoodCategory } from "./entity/asset_good_category"; +import { AssetGood } from "./entity/asset_good"; +import { AssetRequestOrderCategory } from "./entity/asset_request_order_category"; +import { AssetRequestOrder } from "./entity/asset_request_order"; +import { AssetRequestOrderGood } from "./entity/asset_request_order_good"; +import { AssetPurchase } from "./entity/asset_purchase"; +import { AssetPurchaseRequestOrder } from "./entity/asset_purchase_request_order"; +import { AssetPurchaseGoodsReceipt } from "./entity/asset_purchase_goods_receipt"; +import { AssetPurchaseGoodReceiptGood } from "./entity/asset_purchase_goods_receipt_good"; +import { AssetPurchaseRealization } from "./entity/asset_purchase_realization"; +import { AssetPurchaseBondRealizationGood } from "./entity/asset_purchase_purchase_bond_realization_good"; +import { AssetPurchaseInvoice } from "./entity/asset_purchase_invoice"; +import { RemitOtp } from "./entity/remit_otp"; +import { RemitPartnerUser } from "./entity/remit_partner_users"; +import { RemitPartner } from "./entity/remit_partners"; export { User, // @@ -156,5 +159,8 @@ export { AssetPurchaseGoodReceiptGood, AssetPurchaseRealization, AssetPurchaseBondRealizationGood, - AssetPurchaseInvoice + AssetPurchaseInvoice, + RemitOtp, + RemitPartnerUser, + RemitPartner, };