diff --git a/src/entity/brizzi_cards.ts b/src/entity/brizzi_cards.ts index c63c18d..02772e3 100644 --- a/src/entity/brizzi_cards.ts +++ b/src/entity/brizzi_cards.ts @@ -1,82 +1,85 @@ -import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'; +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; -import { BrizziCardStatus } from '../types/brizzi'; -import { BrizziBatch } from './brizzi_batchs'; +import { BrizziCardStatus } from "../types/brizzi"; +import { BrizziBatch } from "./brizzi_batchs"; -@Entity('brizzi_cards', { schema: 'brizzis' }) +@Entity("brizzi_cards", { schema: "brizzis" }) export class BrizziCard { - @PrimaryGeneratedColumn('uuid') - id: string; + @PrimaryGeneratedColumn("uuid") + id: string; - @ManyToOne(() => BrizziBatch, { onDelete: 'RESTRICT' }) - @JoinTable() - batch: BrizziBatch; + @ManyToOne(() => BrizziBatch, { onDelete: "RESTRICT" }) + @JoinTable() + batch: BrizziBatch; - @Column({ - nullable: false, - length: 256 - }) - brand: string; + @Column({ + nullable: false, + length: 256, + }) + brand: string; - @Column({ - nullable: false, - length: 256 - }) - model: string; + @Column({ + nullable: false, + length: 256, + }) + model: string; - @Column({ - nullable: false, - unique: true, - length: 256 - }) - code: string; + @Column({ + nullable: false, + unique: true, + length: 256, + }) + code: string; - @Column({ - nullable: false, - length: 256 - }) - uid: string; + @Column({ + nullable: false, + length: 256, + }) + uid: string; - @Column({ - nullable: true, - length: 4096 - }) - notes: string; + @Column({ + nullable: true, + length: 4096, + }) + notes: string; - @Column({ - type: 'float8', - nullable: false, - default: 0 - }) - balance: number; + @Column({ + type: "float8", + nullable: false, + default: 0, + }) + balance: number; - @Column({ nullable: true }) - balance_at: Date; + @Column({ nullable: true }) + balance_at: Date; - @Column({ - nullable: false, - length: 64 - }) - status: BrizziCardStatus; + @Column({ + nullable: false, + length: 64, + }) + status: BrizziCardStatus; - @Column() - @CreateDateColumn() - created_at: Date; + @Column({ nullable: true }) + active_at: Date; - @Column({ type: "varchar", length: 255 }) - created_by: string; + @Column() + @CreateDateColumn() + created_at: Date; - @Column({ nullable: true }) - @UpdateDateColumn() - updated_at: Date; + @Column({ type: "varchar", length: 255 }) + created_by: string; - @Column({ type: "varchar", length: 255, nullable: true }) - updated_by: string; + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; - @Column({ nullable: true }) - @DeleteDateColumn() - deleted_at: Date; + @Column({ type: "varchar", length: 255, nullable: true }) + updated_by: string; - @Column({ type: "varchar", length: 255, nullable: true }) - deleted_by: string; -} \ No newline at end of file + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ type: "varchar", length: 255, nullable: true }) + deleted_by: string; +} diff --git a/src/entity/trx_customer_slas.ts b/src/entity/trx_customer_slas.ts new file mode 100644 index 0000000..9e21da4 --- /dev/null +++ b/src/entity/trx_customer_slas.ts @@ -0,0 +1,71 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { TrxCustomerPosition, TrxCustomerStatus } from "../types/trx"; +import { TrxCustomer } from "./trx_customers"; + +@Entity("trx_customer_slas", { schema: "trx" }) +export class TrxCustomerSla { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => TrxCustomer, { onDelete: "NO ACTION" }) + @JoinColumn() + customer: TrxCustomer; + + @Column({ + length: 256, + }) + position: TrxCustomerPosition; + + @Column({ + length: 256, + }) + status: TrxCustomerStatus; + + @Column({ + length: 256, + }) + start_by: string; + + @Column({ + nullable: true, + }) + start_at: Date; + + @Column({ + length: 256, + nullable: true, + }) + end_by: string; + + @Column({ + nullable: true, + }) + end_at: Date; + + @Column({ + nullable: true, + type: "float8", + }) + duration: number; + + @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/trx_customers.ts b/src/entity/trx_customers.ts index 970e7fa..7c7c520 100644 --- a/src/entity/trx_customers.ts +++ b/src/entity/trx_customers.ts @@ -1,6 +1,6 @@ import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; import { Status } from "../types/status"; -import { TrxCustomerStatus, TrxCustomerType, TrxIdentityType } from "../types/trx"; +import { TrxCustomerPosition, TrxCustomerStatus, TrxCustomerType, TrxIdentityType } from "../types/trx"; import { TrxOccupation } from "./trx_occupations"; import { TrxCountry } from "./trx_countries"; @@ -99,6 +99,36 @@ export class TrxCustomer { }) 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; diff --git a/src/schema/trx.ts b/src/schema/trx.ts index 4b814a5..fea5985 100644 --- a/src/schema/trx.ts +++ b/src/schema/trx.ts @@ -8,6 +8,7 @@ export * from "../entity/trx_customer_user_signatures"; export * from "../entity/trx_customer_user_refresh_tokens"; export * from "../entity/trx_customer_user_activities"; export * from "../entity/trx_customer_costs"; +export * from "../entity/trx_customer_slas"; export * from "../entity/trx_countries"; export * from "../entity/trx_currencies"; export * from "../entity/trx_country_currencies"; diff --git a/src/types/trx.ts b/src/types/trx.ts index 344a7cb..fa46a16 100644 --- a/src/types/trx.ts +++ b/src/types/trx.ts @@ -15,11 +15,11 @@ export enum TrxVerificationStatus { } export enum TrxCustomerStatus { - "Pending Supervisor" = "pending_supervisor", - "Pending Manager" = "pending_manager", - "Reject" = "reject", + "pending_supervisor" = "pending_supervisor", + "pending_manager" = "pending_manager", + "reject" = "reject", "Active" = "active", - "Not Active" = "not_active", + "not_active" = "not_active", } export enum TrxCustomerType { @@ -27,6 +27,12 @@ export enum TrxCustomerType { "business" = "business", } +export enum TrxCustomerPosition { + "teller" = "teller", + "manager" = "manager", + "done" = "done", +} + export enum TrxCostCode { "BRI_TL_USD" = "BRI_TL_USD", "OTHER_TL_USD" = "OTHER_TL_USD",