Files
entity/src/entity/trx_customers.ts
2025-11-06 22:37:37 +07:00

153 lines
2.5 KiB
TypeScript

import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { Status } from "../types/status";
import { TrxCustomerPosition, TrxCustomerStatus, TrxCustomerType, TrxIdentityType } from "../types/trx";
import { TrxOccupation } from "./trx_occupations";
import { TrxCountry } from "./trx_countries";
@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,
})
pic_file: string;
@Column({
nullable: false,
length: 256,
})
cover_file: string;
@Column({
nullable: false,
length: 256,
})
desclimer_file: string;
@Column({
nullable: false,
length: 64,
})
status: TrxCustomerStatus;
@ManyToOne(() => TrxOccupation, { onDelete: "NO ACTION" })
@JoinTable()
occupation: TrxOccupation;
@ManyToOne(() => TrxCountry, { onDelete: "NO ACTION" })
@JoinTable()
country: TrxCountry;
@Column({
nullable: true,
length: 256,
})
identity_number: string;
@Column({
nullable: true,
length: 256,
})
identity_type: TrxIdentityType;
@Column({
nullable: true,
length: 256,
})
position: TrxCustomerPosition;
@Column({ nullable: true, length: 256 })
tellered_by: string;
@Column({ nullable: true })
tellered_at: Date;
@Column({
nullable: true,
default: false,
})
is_teller: boolean;
@Column({ nullable: true, length: 256 })
manager_by: string;
@Column({ nullable: true })
manager_at: Date;
@Column({
nullable: true,
default: false,
})
is_manager: boolean;
@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;
}