diff --git a/src/entity/trx_bank_swifts.ts b/src/entity/trx_bank_swifts.ts index 3f5b554..55d7ac3 100644 --- a/src/entity/trx_bank_swifts.ts +++ b/src/entity/trx_bank_swifts.ts @@ -1,6 +1,7 @@ import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; import { Status } from "../types/status"; import { TrxBank } from "./trx_banks"; +import { TrxCountry } from "./trx_countries"; @Entity("trx_bank_swifts", { schema: "trx" }) export class TrxBankSwift { @@ -17,6 +18,34 @@ export class TrxBankSwift { }) code: string; + @Column({ + nullable: true, + length: 256, + }) + institution: string; + + @ManyToOne(() => TrxCountry, { onDelete: "NO ACTION" }) + @JoinColumn() + country: TrxCountry; + + @Column({ + nullable: true, + length: 256, + }) + city: string; + + @Column({ + nullable: true, + length: 256, + }) + address: string; + + @Column({ + nullable: true, + length: 256, + }) + location: string; + @Column({ nullable: true, length: 64, diff --git a/src/entity/trx_banks.ts b/src/entity/trx_banks.ts index 3e312ee..6ab946a 100644 --- a/src/entity/trx_banks.ts +++ b/src/entity/trx_banks.ts @@ -1,6 +1,7 @@ -import { Column, CreateDateColumn, DeleteDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; import { Status } from "../types/status"; import { TrxBankType } from "../types/trx"; +import { TrxCountry } from "./trx_countries"; @Entity("trx_banks", { schema: "trx" }) export class TrxBank { @@ -19,11 +20,9 @@ export class TrxBank { }) name: string; - @Column({ - nullable: false, - length: 256, - }) - country: string; + @ManyToOne(() => TrxCountry, { onDelete: "NO ACTION" }) + @JoinColumn() + country: TrxCountry; @Column({ nullable: true, diff --git a/src/entity/trx_countries.ts b/src/entity/trx_countries.ts new file mode 100644 index 0000000..8b635f7 --- /dev/null +++ b/src/entity/trx_countries.ts @@ -0,0 +1,46 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; + +@Entity("trx_countries", { schema: "trx" }) +export class TrxCountry { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: true, + length: 256, + }) + name: string; + + @Column({ + nullable: true, + length: 2, + }) + alpha_3: string; + + @Column({ + nullable: true, + length: 2, + }) + alpha_2: 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; +} diff --git a/src/schema/trx.ts b/src/schema/trx.ts index d868d9b..87dc11d 100644 --- a/src/schema/trx.ts +++ b/src/schema/trx.ts @@ -50,6 +50,7 @@ export * from "../entity/trx_customer_users"; 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_countries"; export * from "../entity/trx_banks"; export * from "../entity/trx_bank_swifts"; export * from "../types/trx";