This commit is contained in:
fro1991
2025-10-18 00:34:06 +07:00
parent fd384a1798
commit dd81a28d4e
4 changed files with 163 additions and 0 deletions

View File

@ -0,0 +1,67 @@
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";
import { TrxCustomer } from "./trx_customers";
import { Branch } from "./branchs";
@Entity("trx_customer_accounts", { schema: "trx" })
export class TrxCustomerAccount {
@PrimaryGeneratedColumn("uuid")
id: string;
@ManyToOne(() => TrxCustomer, { onDelete: "RESTRICT" })
@JoinColumn()
customer: TrxCustomer;
@ManyToOne(() => Branch, { onDelete: "NO ACTION" })
@JoinColumn()
branch: Branch;
@Column({
nullable: false,
length: 256,
})
cif_number: string;
@Column({
nullable: false,
length: 256,
})
account_number: string;
@Column({
nullable: false,
length: 256,
})
name: string;
@Column({
nullable: true,
length: 4096,
})
address: string;
@Column({
type: "float8",
})
balance: number;
@Column({
nullable: false,
})
balance_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,88 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { Status } from "../types/status";
import { TrxCustomerType } from "../types/trx";
@Entity("trx_customers", { schema: "trx" })
export class TrxCustomer {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: false,
length: 4096,
})
type: TrxCustomerType;
@Column({
nullable: false,
unique: true,
length: 256,
})
code: string;
@Column({
nullable: false,
unique: true,
length: 256,
})
name: string;
@Column({
nullable: false,
length: 4096,
})
address: string;
@Column({
nullable: false,
length: 256,
})
pic_name: string;
@Column({
nullable: false,
unique: true,
length: 256,
})
pic_phone: string;
@Column({
nullable: false,
unique: true,
length: 256,
})
pic_email: string;
@Column({
nullable: false,
length: 256,
})
desclimer: 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;
}

View File

@ -42,4 +42,7 @@ 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 "../entity/trx_customers";
export * from "../entity/trx_customer_accounts";
export * from "../types/trx";

View File

@ -1,3 +1,8 @@
export enum TrxCustomerType {
"personal" = "personal",
"business" = "business",
}
export enum TrxTransactionStatus {
"verify" = "verify",
"open" = "open",