This commit is contained in:
fro1991
2025-10-14 18:15:48 +07:00
25 changed files with 707 additions and 534 deletions

184
src/entity/gps_vehicles.ts Normal file
View File

@ -0,0 +1,184 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn, OneToOne, JoinColumn } from "typeorm";
import { GpsDevice } from "./gps_devices";
export abstract class BaseEntityAudit {
@CreateDateColumn({ name: "created_at" })
created_at: Date;
@Column({ type: "varchar", length: 255 })
created_by: string;
@UpdateDateColumn({ name: "updated_at", nullable: true })
updated_at?: Date;
@Column({ type: "varchar", length: 255, nullable: true })
updated_by?: string;
@DeleteDateColumn({ name: "deleted_at", nullable: true })
deleted_at?: Date;
@Column({ type: "varchar", length: 255, nullable: true })
deleted_by?: string;
}
@Entity("gps_vehicles", { schema: "gps" })
export class GpsVehicles extends BaseEntityAudit {
@PrimaryGeneratedColumn("uuid")
vehicle_id: string;
@Column({ type: "varchar", length: 255, nullable: true })
name?: string;
@OneToOne(() => GpsDevice, { nullable: true, onDelete: "SET NULL" })
@JoinColumn({ name: "device_id", referencedColumnName: "id" })
device_id?: GpsDevice;
@Column({ type: "json", nullable: true })
vehicle_dt?: Record<string, any>;
// =============================
@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;
}
@Entity("gps_vehicle_types", { schema: "gps" })
export class GpsVehicleTypes extends BaseEntityAudit {
@PrimaryGeneratedColumn("uuid")
vehicle_type_id: string;
@Column({ type: "json", nullable: true })
vehicle_type_dt?: Record<string, any>;
// =============================
@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;
}
@Entity("gps_vehicle_brands", { schema: "gps" })
export class GpsVehicleBrands extends BaseEntityAudit {
@PrimaryGeneratedColumn("uuid")
vehicle_brand_id: string;
@Column({ type: "json", nullable: true })
vehicle_brand_dt?: Record<string, any>;
// =============================
@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;
}
@Entity("gps_vehicle_cats", { schema: "gps" })
export class GpsVehicleCats extends BaseEntityAudit {
@PrimaryGeneratedColumn("uuid")
vehicle_cat_id: string;
@Column({ type: "json", nullable: true })
vehicle_cat_dt?: Record<string, any>;
// =============================
@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;
}
@Entity("gps_vehicle_models", { schema: "gps" })
export class GpsVehicleModels extends BaseEntityAudit {
@PrimaryGeneratedColumn("uuid")
vehicle_model_id: string;
@Column({ type: "json", nullable: true })
vehicle_model_dt?: Record<string, any>;
// =============================
@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;
}

View File

@ -0,0 +1,40 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from "typeorm";
import { Status } from "../types/status";
@Entity("trx_authenticators", { schema: "trx" })
export class TrxAuthenticator {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: false,
unique: true,
length: 256,
})
authenticator: string;
@Column({ nullable: false })
generated_at: Date;
@Column({ type: "boolean", nullable: true })
is_valid: boolean;
@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;
}

View File

@ -23,10 +23,6 @@ export class TrxCif {
})
status: Status;
@ManyToOne(() => TrxCompanyUser, (company_user) => company_user.id, { onDelete: "RESTRICT" })
@JoinColumn()
company_user: TrxCompanyUser;
@Column()
@CreateDateColumn()
created_at: Date;

View File

@ -45,9 +45,6 @@ export class TrxCompanyUser {
})
name: string;
@OneToMany(() => TrxConfigLevel, (configLevel) => configLevel.user, { cascade: true })
level: TrxConfigLevel[];
@ManyToOne(() => TrxCompany, { onDelete: "NO ACTION" })
@JoinTable()
company: TrxCompany;

View File

@ -1,6 +1,6 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm";
import { Status } from "../types/status";
import { TrxCompanyUser } from "./trx_company_users";
import { TrxPartnerUser } from "./trx_partner_users";
@Entity("trx_config_levels", { schema: "trx" })
export class TrxConfigLevel {
@ -22,9 +22,6 @@ export class TrxConfigLevel {
})
status: Status;
@ManyToOne(() => TrxCompanyUser, (user) => user.level, { onDelete: "CASCADE" })
user: TrxCompanyUser;
@Column()
@CreateDateColumn()
created_at: Date;

View File

@ -1,3 +1,4 @@
import bcrypt from "bcryptjs";
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from "typeorm";
@Entity("trx_otp_emails", { schema: "trx" })
@ -5,6 +6,13 @@ export class TrxOtpEmail {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: true,
unique: true,
length: 64,
})
codeid: string;
@Column({
nullable: false,
length: 64,
@ -13,7 +21,6 @@ export class TrxOtpEmail {
@Column({
nullable: false,
unique: true,
length: 64,
})
email: string;
@ -40,4 +47,12 @@ export class TrxOtpEmail {
@Column({ nullable: true })
@DeleteDateColumn()
deleted_at: Date;
hashOtp() {
this.otp = bcrypt.hashSync(this.otp, 8);
}
checkIfOtpMatch(unencryptedOtp: string) {
return bcrypt.compareSync(unencryptedOtp, this.otp);
}
}

View File

@ -1,3 +1,4 @@
import bcrypt from "bcryptjs";
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from "typeorm";
@Entity("trx_otp_numbers", { schema: "trx" })
@ -5,6 +6,13 @@ export class TrxOtpNumber {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: true,
unique: true,
length: 64,
})
codeid: string;
@Column({
nullable: false,
length: 64,
@ -13,7 +21,6 @@ export class TrxOtpNumber {
@Column({
nullable: false,
unique: true,
length: 64,
})
number: string;
@ -39,4 +46,12 @@ export class TrxOtpNumber {
@Column({ nullable: true })
@DeleteDateColumn()
deleted_at: Date;
hashOtp() {
this.otp = bcrypt.hashSync(this.otp, 8);
}
checkIfOtpMatch(unencryptedOtp: string) {
return bcrypt.compareSync(unencryptedOtp, this.otp);
}
}

View File

@ -0,0 +1,49 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from "typeorm";
import { Status } from "../types/status";
import { TrxPartner } from "./trx_partners";
import { TrxCif } from "./trx_cifs";
@Entity("trx_partner_accounts", { schema: "trx" })
export class TrxPartnerAccount {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: true,
length: 256,
})
name: string;
@Column({
nullable: false,
length: 256,
})
account_number: string;
@ManyToOne(() => TrxPartner, (partner) => partner.partner_account, { onDelete: "RESTRICT" })
@JoinColumn()
partner: TrxPartner;
@ManyToOne(() => TrxCif, { onDelete: "RESTRICT", nullable: true })
@JoinTable()
cif: TrxCif;
@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;
}

View File

@ -0,0 +1,63 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm";
import { ActivityType } from "../types/action";
import { TrxPartnerUser } from "./trx_partner_users";
@Entity("trx_partner_user_activities", { schema: "trx" })
export class TrxPartnerUserActivity {
@PrimaryGeneratedColumn("uuid")
id: string;
@ManyToOne(() => TrxPartnerUser, { onDelete: "NO ACTION", nullable: false })
@JoinColumn()
user: TrxPartnerUser;
@Index()
@Column({
type: "uuid",
})
refresh_token: string;
@Index()
@Column({
nullable: false,
length: 512,
})
module: string;
@Column({
nullable: false,
length: 2048,
})
description: string;
@Column({
nullable: true,
length: 1,
})
action: ActivityType;
@Column({
nullable: false,
length: 2048,
})
url: String;
@Column({
type: "text",
nullable: true,
})
data_body: String;
@Column()
@CreateDateColumn()
created_at: Date;
@Column({ nullable: true })
@UpdateDateColumn()
updated_at: Date;
@Column({ nullable: true })
@DeleteDateColumn()
deleted_at: Date;
}

View File

@ -0,0 +1,64 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from "typeorm";
@Entity("trx_partner_user_refresh_tokens", { schema: "trx" })
export class TrxPartnerUserRefreshToken {
@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;
}

View File

@ -0,0 +1,90 @@
import bcrypt from "bcryptjs";
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, ManyToOne, OneToMany, JoinTable } from "typeorm";
import { Status } from "../types/status";
import { TrxPartner } from "./trx_partners";
@Entity("trx_partner_users", { schema: "trx" })
export class TrxPartnerUser {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: false,
unique: true,
length: 64,
})
email: string;
@Column({
nullable: false,
unique: true,
length: 256,
})
phone: string;
@Column({
nullable: false,
length: 64,
select: false,
})
password: string;
@Column({
nullable: false,
unique: true,
length: 64,
})
username: string;
@Column({
nullable: false,
length: 64,
unique: false,
})
name: string;
@ManyToOne(() => TrxPartner, { onDelete: "RESTRICT" })
@JoinTable()
partner: TrxPartner;
@Column({
type: "jsonb",
nullable: true,
})
level: string[];
@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);
}
}

View File

@ -1,19 +1,34 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { TrxCompany } from "./trx_companies";
import { Status } from "../types/status";
import { TrxConfigNationality } from "./trx_config_nationalities";
import { TrxTransactionRemittance } from "./trx_transaction_remittance";
import { TrxConfigBank } from "./trx_config_banks";
import { TrxCif } from "./trx_cifs";
import { TrxPartnerType } from "../types/trx";
import { TrxPartnerAccount } from "./trx_partner_accounts";
@Entity("trx_recepient_remittances", { schema: "trx" })
export class TrxRecepientRemittance {
@Entity("trx_partners", { schema: "trx" })
export class TrxPartner {
@PrimaryGeneratedColumn("uuid")
id: string;
@OneToOne(() => TrxTransactionRemittance, (transaction_remittance) => transaction_remittance.recepient_remittance, { onDelete: "CASCADE" })
transaction_remittance: TrxTransactionRemittance;
@OneToMany(() => TrxPartnerAccount, (partner_account) => partner_account.partner, { cascade: true, nullable: false })
partner_account: TrxPartnerAccount[];
@Column({
nullable: false,
length: 4096,
})
type: TrxPartnerType;
@Column({
nullable: false,
unique: true,
length: 256,
})
code: string;
@Column({
nullable: false,
unique: true,
length: 256,
})
name: string;
@ -22,23 +37,21 @@ export class TrxRecepientRemittance {
nullable: false,
length: 256,
})
iban: string;
pic_name: string;
@Column({
nullable: false,
unique: true,
length: 256,
})
phone: string;
@ManyToOne(() => TrxConfigBank, { onDelete: "NO ACTION", nullable: false })
@JoinColumn()
recepient_bank: TrxConfigBank;
pic_phone: string;
@Column({
nullable: false,
unique: false,
length: 256,
})
account_number: string;
pic_email: string;
@Column({
nullable: true,
@ -46,10 +59,6 @@ export class TrxRecepientRemittance {
})
address: string;
@ManyToOne(() => TrxConfigNationality, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
nationality: TrxConfigNationality;
@Column({
nullable: false,
length: 64,

View File

@ -1,16 +1,36 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { Status } from "../types/status";
import { TrxConfigNationality } from "./trx_config_nationalities";
import { TrxTransactionSwift } from "./trx_transaction_swift";
import { TrxConfigBank } from "./trx_config_banks";
import { TrxTransaction } from "./trx_transactions";
@Entity("trx_recepient_swifts", { schema: "trx" })
export class TrxRecepientSwift {
@Entity("trx_recepients", { schema: "trx" })
export class TrxRecepient {
@PrimaryGeneratedColumn("uuid")
id: string;
@OneToOne(() => TrxTransactionSwift, (transaction_swift) => transaction_swift.recepient_swift, { onDelete: "CASCADE" })
transaction_swift: TrxTransactionSwift;
@OneToOne(() => TrxTransaction, (transaction) => transaction.recepient, { onDelete: "CASCADE" })
transaction: TrxTransaction;
@ManyToOne(() => TrxConfigBank, { onDelete: "NO ACTION", nullable: false })
@JoinColumn()
bank: TrxConfigBank;
@ManyToOne(() => TrxConfigNationality, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
nationality: TrxConfigNationality;
@Column({
nullable: false,
length: 256,
})
account_number: string;
@Column({
nullable: true,
length: 256,
})
iban: string;
@Column({
nullable: false,
@ -18,27 +38,17 @@ export class TrxRecepientSwift {
})
name: string;
@Column({
nullable: false,
length: 256,
})
iban: string;
@Column({
nullable: false,
length: 256,
})
phone: string;
@ManyToOne(() => TrxConfigBank, { onDelete: "NO ACTION", nullable: false })
@JoinColumn()
recepient_bank: TrxConfigBank;
@Column({
nullable: false,
length: 256,
})
account_number: string;
email: string;
@Column({
nullable: true,
@ -46,10 +56,6 @@ export class TrxRecepientSwift {
})
address: string;
@ManyToOne(() => TrxConfigNationality, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
nationality: TrxConfigNationality;
@Column({
nullable: false,
length: 64,

View File

@ -1,72 +0,0 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { Status } from "../types/status";
import { TrxConfigNationality } from "./trx_config_nationalities";
import { TrxCompanyAccount } from "./trx_company_accounts";
import { TrxTransactionDomestic } from "./trx_transaction_domestic";
import { TrxConfigBank } from "./trx_config_banks";
@Entity("trx_sender_domestics", { schema: "trx" })
export class TrxSenderDomestic {
@PrimaryGeneratedColumn("uuid")
id: string;
@OneToOne(() => TrxTransactionDomestic, (transaction) => transaction.sender_domestic, { onDelete: "CASCADE" })
transaction_domestic: TrxTransactionDomestic;
@Column({
nullable: false,
length: 256,
})
name: string;
@Column({
nullable: false,
length: 256,
})
phone: string;
@Column({
nullable: true,
length: 4096,
})
address: string;
@ManyToOne(() => TrxConfigNationality, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
nationality: TrxConfigNationality;
@ManyToOne(() => TrxCompanyAccount, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
company_account: TrxCompanyAccount;
@ManyToOne(() => TrxConfigBank, { onDelete: "NO ACTION", nullable: false })
@JoinColumn()
sender_bank: TrxConfigBank;
@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;
}

View File

@ -1,72 +0,0 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { Status } from "../types/status";
import { TrxConfigNationality } from "./trx_config_nationalities";
import { TrxCompanyAccount } from "./trx_company_accounts";
import { TrxTransactionRemittance } from "./trx_transaction_remittance";
import { TrxConfigBank } from "./trx_config_banks";
@Entity("trx_sender_remittances", { schema: "trx" })
export class TrxSenderRemittance {
@PrimaryGeneratedColumn("uuid")
id: string;
@OneToOne(() => TrxTransactionRemittance, (transaction) => transaction.sender_remittance, { onDelete: "CASCADE" })
transaction_remittance: TrxTransactionRemittance;
@Column({
nullable: false,
length: 256,
})
name: string;
@Column({
nullable: false,
length: 256,
})
phone: string;
@Column({
nullable: true,
length: 4096,
})
address: string;
@ManyToOne(() => TrxConfigNationality, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
nationality: TrxConfigNationality;
@ManyToOne(() => TrxCompanyAccount, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
company_account: TrxCompanyAccount;
@ManyToOne(() => TrxConfigBank, { onDelete: "NO ACTION", nullable: false })
@JoinColumn()
sender_bank: TrxConfigBank;
@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;
}

View File

@ -1,72 +0,0 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { Status } from "../types/status";
import { TrxConfigNationality } from "./trx_config_nationalities";
import { TrxCompanyAccount } from "./trx_company_accounts";
import { TrxTransactionSwift } from "./trx_transaction_swift";
import { TrxConfigBank } from "./trx_config_banks";
@Entity("trx_sender_swifts", { schema: "trx" })
export class TrxSenderSwift {
@PrimaryGeneratedColumn("uuid")
id: string;
@OneToOne(() => TrxTransactionSwift, (transaction) => transaction.sender_swift, { onDelete: "CASCADE" })
transaction_swift: TrxTransactionSwift;
@Column({
nullable: false,
length: 256,
})
name: string;
@Column({
nullable: false,
length: 256,
})
phone: string;
@Column({
nullable: true,
length: 4096,
})
address: string;
@ManyToOne(() => TrxConfigNationality, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
nationality: TrxConfigNationality;
@ManyToOne(() => TrxCompanyAccount, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
company_account: TrxCompanyAccount;
@ManyToOne(() => TrxConfigBank, { onDelete: "NO ACTION", nullable: false })
@JoinColumn()
sender_bank: TrxConfigBank;
@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;
}

View File

@ -1,16 +1,29 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { Status } from "../types/status";
import { TrxConfigNationality } from "./trx_config_nationalities";
import { TrxTransactionDomestic } from "./trx_transaction_domestic";
import { TrxPartnerAccount } from "./trx_partner_accounts";
import { TrxTransaction } from "./trx_transactions";
import { TrxConfigBank } from "./trx_config_banks";
@Entity("trx_recepient_domestics", { schema: "trx" })
export class TrxRecepientDomestic {
@Entity("trx_senders", { schema: "trx" })
export class TrxSender {
@PrimaryGeneratedColumn("uuid")
id: string;
@OneToOne(() => TrxTransactionDomestic, (transaction_domestic) => transaction_domestic.recepient_domestic, { onDelete: "CASCADE" })
transaction_domestic: TrxTransactionDomestic;
@OneToOne(() => TrxTransaction, (transaction) => transaction.sender, { onDelete: "CASCADE" })
transaction: TrxTransaction;
@ManyToOne(() => TrxConfigNationality, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
nationality: TrxConfigNationality;
@ManyToOne(() => TrxPartnerAccount, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
partner_account: TrxPartnerAccount;
@ManyToOne(() => TrxConfigBank, { onDelete: "NO ACTION", nullable: false })
@JoinColumn()
bank: TrxConfigBank;
@Column({
nullable: false,
@ -24,21 +37,11 @@ export class TrxRecepientDomestic {
})
phone: string;
@ManyToOne(() => TrxConfigBank, { onDelete: "NO ACTION", nullable: false })
@JoinColumn()
recepient_bank: TrxConfigBank;
@Column({
nullable: false,
length: 256,
})
account_number: string;
@Column({
nullable: true,
length: 256,
})
iban: string;
email: string;
@Column({
nullable: true,
@ -46,10 +49,6 @@ export class TrxRecepientDomestic {
})
address: string;
@ManyToOne(() => TrxConfigNationality, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
nationality: TrxConfigNationality;
@Column({
nullable: false,
length: 64,

50
src/entity/trx_swifts.ts Normal file
View File

@ -0,0 +1,50 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { TrxTransaction } from "./trx_transactions";
@Entity("trx_swifts", { schema: "trx" })
export class TrxSwift {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: true,
length: 256,
})
invoice: string;
@Column({
nullable: true,
length: 256,
})
bic: string;
@Column({
nullable: true,
length: 4096,
})
file: string;
@OneToOne(() => TrxTransaction, (transaction) => transaction.swift, { onDelete: "CASCADE" })
transaction: TrxTransaction;
@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;
}

View File

@ -1,13 +1,10 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { TrxCompany } from "./trx_companies";
import { TrxConfigSourceIncome } from "./trx_config_source_incomes";
import { TrxSenderDomestic } from "./trx_sender_domestic";
import { TrxRecepientDomestic } from "./trx_recepient_domestic";
import { TrxTransaction } from "./trx_transactions";
import { TrxTransactionTypeStatus, TrxTransactionCorrespondentFees, TrxTransactionStatus } from "./../types/trx";
import { TrxTransactionTypeStatus, TrxTransactionCorrespondentFees, TrxTransactionStatus } from "../types/trx";
@Entity("trx_transaction_domestics", { schema: "trx" })
export class TrxTransactionDomestic {
@Entity("trx_transaction_amounts", { schema: "trx" })
export class TrxTransactionAmount {
@PrimaryGeneratedColumn("uuid")
id: string;
@ -42,23 +39,15 @@ export class TrxTransactionDomestic {
sub_total: number;
@Column({ type: "float8", nullable: false, default: 0 })
rate_idr: number;
rate: number;
@OneToOne(() => TrxTransaction, (transaction) => transaction.transaction_domestic, { onDelete: "CASCADE" })
@OneToOne(() => TrxTransaction, (transaction) => transaction.transaction_amount, { onDelete: "CASCADE" })
transaction: TrxTransaction;
@ManyToOne(() => TrxConfigSourceIncome, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
source_income: TrxConfigSourceIncome;
@OneToOne(() => TrxSenderDomestic, (sender) => sender.transaction_domestic, { cascade: true })
@JoinColumn()
sender_domestic: TrxSenderDomestic;
@OneToOne(() => TrxRecepientDomestic, (recepient) => recepient.transaction_domestic, { cascade: true })
@JoinColumn()
recepient_domestic: TrxRecepientDomestic;
@Column()
@CreateDateColumn()
created_at: Date;

View File

@ -1,82 +0,0 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { TrxCompany } from "./trx_companies";
import { TrxConfigSourceIncome } from "./trx_config_source_incomes";
import { TrxSenderRemittance } from "./trx_sender_remittance";
import { TrxRecepientRemittance } from "./trx_recepient_remittance";
import { TrxTransaction } from "./trx_transactions";
import { TrxTransactionTypeStatus, TrxTransactionCorrespondentFees, TrxTransactionStatus } from "./../types/trx";
@Entity("trx_transaction_remittances", { schema: "trx" })
export class TrxTransactionRemittance {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: false,
length: 256,
})
type_transaction: TrxTransactionTypeStatus;
@Column({
nullable: true,
length: 256,
})
correspondent_fees: string;
@Column({ type: "float8" })
amount_overbooking: number;
@Column({ type: "float8", nullable: true })
transfer_amount: number;
@Column({ type: "float8", nullable: true })
transfer_total: number;
@Column({ type: "float8", nullable: true })
commission: number;
@Column({ type: "float8", nullable: true })
cost_of_sender: number;
@Column({ type: "float8", nullable: true })
sub_total: number;
@Column({ type: "float8", nullable: false, default: 0 })
rate_idr: number;
@OneToOne(() => TrxTransaction, (transaction) => transaction.transaction_remittance, { onDelete: "CASCADE" })
transaction: TrxTransaction;
@ManyToOne(() => TrxConfigSourceIncome, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
source_income: TrxConfigSourceIncome;
@OneToOne(() => TrxSenderRemittance, (sender) => sender.transaction_remittance, { cascade: true })
@JoinColumn()
sender_remittance: TrxSenderRemittance;
@OneToOne(() => TrxRecepientRemittance, (recepient) => recepient.transaction_remittance, { cascade: true })
@JoinColumn()
recepient_remittance: TrxRecepientRemittance;
@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;
}

View File

@ -1,100 +0,0 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { TrxCompany } from "./trx_companies";
import { TrxConfigSourceIncome } from "./trx_config_source_incomes";
import { TrxSenderSwift } from "./trx_sender_swift";
import { TrxRecepientSwift } from "./trx_recepient_swift";
import { TrxTransaction } from "./trx_transactions";
import { TrxTransactionTypeStatus, TrxTransactionCorrespondentFees, TrxTransactionStatus } from "./../types/trx";
@Entity("trx_transaction_swifts", { schema: "trx" })
export class TrxTransactionSwift {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: false,
length: 256,
})
type_transaction: TrxTransactionTypeStatus;
@Column({
nullable: true,
length: 256,
})
correspondent_fees: string;
@Column({ type: "float8" })
amount_overbooking: number;
@Column({ type: "float8", nullable: true })
transfer_amount: number;
@Column({ type: "float8", nullable: true })
transfer_total: number;
@Column({ type: "float8", nullable: true })
commission: number;
@Column({ type: "float8", nullable: true })
cost_of_sender: number;
@Column({ type: "float8", nullable: true })
sub_total: number;
@Column({ type: "float8", nullable: false, default: 0 })
rate_idr: number;
@OneToOne(() => TrxTransaction, (transaction) => transaction.transaction_swift, { onDelete: "CASCADE" })
transaction: TrxTransaction;
@ManyToOne(() => TrxConfigSourceIncome, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
source_income: TrxConfigSourceIncome;
@OneToOne(() => TrxSenderSwift, (sender) => sender.transaction_swift, { cascade: true })
@JoinColumn()
sender_swift: TrxSenderSwift;
@OneToOne(() => TrxRecepientSwift, (recepient) => recepient.transaction_swift, { cascade: true })
@JoinColumn()
recepient_swift: TrxRecepientSwift;
@Column({
nullable: true,
length: 4096,
})
file: String;
@Column({
nullable: true,
length: 256,
})
bic: String;
@Column({
nullable: true,
length: 4096,
})
invoice: 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;
}

View File

@ -1,30 +1,40 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { TrxCompany } from "./trx_companies";
import { TrxTransactionDomestic } from "./trx_transaction_domestic";
import { TrxTransactionTransferStatus, TrxTransactionStatus } from "./../types/trx";
import { TrxTransactionRemittance } from "./trx_transaction_remittance";
import { TrxTransactionSwift } from "./trx_transaction_swift";
import { TrxTransactionTransferStatus, TrxTransactionStatus } from "../types/trx";
import { TrxPartner } from "./trx_partners";
import { TrxAuthenticator } from "./trx_authenticators";
import { TrxSender } from "./trx_senders";
import { TrxRecepient } from "./trx_recepients";
import { TrxSwift } from "./trx_swifts";
import { TrxTransactionAmount } from "./trx_transaction_amounts";
@Entity("trx_transactions", { schema: "trx" })
export class TrxTransaction {
@PrimaryGeneratedColumn("uuid")
id: string;
@ManyToOne(() => TrxCompany, { onDelete: "NO ACTION", nullable: false })
@ManyToOne(() => TrxAuthenticator, { onDelete: "RESTRICT", nullable: true })
@JoinColumn()
company: TrxCompany;
authenticator: TrxAuthenticator;
@OneToOne(() => TrxTransactionDomestic, (transaction_domestic) => transaction_domestic.transaction, { cascade: true })
@ManyToOne(() => TrxPartner, { onDelete: "RESTRICT", nullable: false })
@JoinColumn()
transaction_domestic: TrxTransactionDomestic;
partner: TrxPartner;
@OneToOne(() => TrxTransactionRemittance, (transaction_remittance) => transaction_remittance.transaction, { cascade: true })
@OneToOne(() => TrxSender, (sender) => sender.transaction, { cascade: true })
@JoinColumn()
transaction_remittance: TrxTransactionRemittance;
sender: TrxSender;
@OneToOne(() => TrxTransactionSwift, (transaction_swift) => transaction_swift.transaction, { cascade: true })
@OneToOne(() => TrxRecepient, (recepient) => recepient.transaction, { cascade: true })
@JoinColumn()
transaction_swift: TrxTransactionSwift;
recepient: TrxRecepient;
@OneToOne(() => TrxTransactionAmount, (transaction_amount) => transaction_amount.transaction, { cascade: true })
@JoinColumn()
transaction_amount: TrxTransactionAmount;
@OneToOne(() => TrxSwift, (swift) => swift.transaction, { cascade: true })
@JoinColumn()
swift: TrxSwift;
@Column({
nullable: false,
@ -40,12 +50,9 @@ export class TrxTransaction {
type_transfer: TrxTransactionTransferStatus;
@Column({
nullable: true,
length: 4096,
nullable: false,
default: false,
})
signatures: String;
@Column({ type: "boolean", nullable: true })
is_maker_approved: boolean;
@Column({ type: "varchar", length: 100, nullable: true })
@ -57,7 +64,10 @@ export class TrxTransaction {
@Column({ nullable: true })
maker_approved_at: Date;
@Column({ type: "boolean", nullable: true })
@Column({
nullable: false,
default: false,
})
is_checker_approved: boolean;
@Column({ type: "varchar", length: 100, nullable: true })
@ -69,7 +79,10 @@ export class TrxTransaction {
@Column({ nullable: true })
checker_approved_at: Date;
@Column({ type: "boolean", nullable: true })
@Column({
nullable: false,
default: false,
})
is_signer_approved: boolean;
@Column({ type: "varchar", length: 100, nullable: true })
@ -81,41 +94,29 @@ export class TrxTransaction {
@Column({ nullable: true })
signer_approved_at: Date;
@Column({ type: "boolean", nullable: true })
is_tl_approved: boolean;
@Column({ type: "varchar", length: 100, nullable: true })
tl_approved_by: string;
@Column({ type: "varchar", length: 4096, nullable: true })
tl_note: string;
@Column({ nullable: true })
tl_approved_at: Date;
@Column({
nullable: true,
length: 4096,
})
tl_signatures: String;
is_valid_otp: String;
@Column({ type: "boolean", nullable: true })
is_spv_approved: boolean;
is_release: boolean;
@Column({ type: "varchar", length: 100, nullable: true })
spv_approved_by: string;
release_by: string;
@Column({ type: "varchar", length: 4096, nullable: true })
spv_note: string;
release_note: string;
@Column({ nullable: true })
spv_approved_at: Date;
release_at: Date;
@Column({
nullable: true,
length: 4096,
length: 256,
})
spv_signatures: String;
release_file: string;
@Column({ type: "varchar", length: 4096, nullable: true })
remark: string;

View File

@ -1,3 +1,4 @@
export * from "../types/gps";
export * from "../entity/gps_devices";
export * from "../entity/gps_device_log";
export * from "../entity/gps_vehicles";

View File

@ -31,14 +31,15 @@ export * from "../entity/trx_region_administrativus";
export * from "../entity/trx_region_aldeias";
export * from "../entity/trx_region_sucos";
export * from "../entity/trx_registration";
export * from "../entity/trx_sender_remittance";
export * from "../entity/trx_recepient_remittance";
export * from "../entity/trx_sender_domestic";
export * from "../entity/trx_recepient_domestic";
export * from "../entity/trx_transaction_domestic";
export * from "../entity/trx_transaction_remittance";
export * from "../entity/trx_transactions";
export * from "../entity/trx_transaction_swift";
export * from "../entity/trx_sender_swift";
export * from "../entity/trx_recepient_swift";
export * from "../entity/trx_transaction_amounts";
export * from "../entity/trx_senders";
export * from "../entity/trx_recepients";
export * from "../entity/trx_swifts";
export * from "../entity/trx_authenticators";
export * from "../entity/trx_partners";
export * from "../entity/trx_partner_accounts";
export * from "../entity/trx_partner_user_activities";
export * from "../entity/trx_partner_user_refresh_tokens";
export * from "../entity/trx_partner_users";
export * from "../types/trx";

View File

@ -15,6 +15,11 @@ export enum TrxTransactionTypeStatus {
"rtgs" = "rtgs",
}
export enum TrxPartnerType {
"company" = "company",
"personal" = "personal",
}
export enum TrxTransactionTransferStatus {
"remittance" = "remittance",
"swift" = "swift",