diff --git a/src/entity/trx_cifs.ts b/src/entity/trx_cifs.ts index a335205..9b7dda9 100644 --- a/src/entity/trx_cifs.ts +++ b/src/entity/trx_cifs.ts @@ -13,7 +13,7 @@ export class TrxCif { number: string; @Column({ - nullable: true, + nullable: false, }) generated_at: Date; diff --git a/src/entity/trx_companies.ts b/src/entity/trx_companies.ts index c563669..fca0c42 100644 --- a/src/entity/trx_companies.ts +++ b/src/entity/trx_companies.ts @@ -21,12 +21,6 @@ export class TrxCompany { }) code: string; - @Column({ - nullable: true, - length: 4096, - }) - description: string; - @Column({ nullable: false, length: 64, @@ -41,7 +35,7 @@ export class TrxCompany { @Column({ nullable: false, - unique: false, + unique: true, length: 256, }) pic_phone: string; diff --git a/src/entity/trx_company_accounts.ts b/src/entity/trx_company_accounts.ts index 69685d9..3ce7d8f 100644 --- a/src/entity/trx_company_accounts.ts +++ b/src/entity/trx_company_accounts.ts @@ -2,19 +2,13 @@ import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateCol import { Status } from "../types/status"; import { TrxCompany } from "./trx_companies"; +import { TrxCif } from "./trx_cifs"; @Entity("trx_company_accounts", { schema: "trx" }) export class TrxCompanyAccount { @PrimaryGeneratedColumn("uuid") id: string; - @Column({ - nullable: false, - unique: true, - length: 256, - }) - code: string; - @Column({ nullable: true, length: 256, @@ -27,32 +21,13 @@ export class TrxCompanyAccount { }) account_number: string; - @Column({ - nullable: false, - length: 256, - }) - account_holder: string; - @ManyToOne(() => TrxCompany, { onDelete: "NO ACTION", nullable: true }) @JoinTable() company: TrxCompany; - @Column({ - nullable: true, - }) - last_trans_at: Date; - - @Column({ - nullable: true, - length: 256, - }) - last_trans_ref_number: string; - - @Column({ - nullable: true, - type: "float8", - }) - last_trans_amount: number; + @ManyToOne(() => TrxCif, { onDelete: "NO ACTION", nullable: true }) + @JoinTable() + cif: TrxCif; @Column() @CreateDateColumn() diff --git a/src/entity/trx_company_users.ts b/src/entity/trx_company_users.ts index 8d53549..caf3d71 100644 --- a/src/entity/trx_company_users.ts +++ b/src/entity/trx_company_users.ts @@ -11,11 +11,18 @@ export class TrxCompanyUser { @Column({ nullable: false, - unique: false, + unique: true, length: 64, }) email: string; + @Column({ + nullable: false, + unique: true, + length: 256, + }) + phone: string; + @Column({ nullable: false, length: 64, @@ -25,7 +32,7 @@ export class TrxCompanyUser { @Column({ nullable: false, - unique: false, + unique: true, length: 64, }) username: string; diff --git a/src/entity/trx_registration.ts b/src/entity/trx_registration.ts new file mode 100644 index 0000000..8a74c97 --- /dev/null +++ b/src/entity/trx_registration.ts @@ -0,0 +1,58 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { TrxCompany } from "./trx_companies"; +import { Status } from "../types/status"; +import { TrxCif } from "./trx_cifs"; + +@Entity("trx_registrations", { schema: "trx" }) +export class TrxRegistration { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + length: 256, + unique: true, + }) + code: string; + + @ManyToOne(() => TrxCompany, { onDelete: "RESTRICT", nullable: true }) + @JoinColumn() + company: TrxCompany; + + @ManyToOne(() => TrxCif, { onDelete: "RESTRICT", nullable: true }) + @JoinColumn() + cif: TrxCif; + + @Column({ + nullable: false, + length: 64, + }) + status: Status; + + @Column({ nullable: true }) + registration_at: Date; + + @Column({ nullable: true, length: 256 }) + registration_by: 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 6ca6a38..c37e93d 100644 --- a/src/schema/trx.ts +++ b/src/schema/trx.ts @@ -25,3 +25,4 @@ export * from "../entity/trx_region_munisipos"; export * from "../entity/trx_region_administrativus"; export * from "../entity/trx_region_aldeias"; export * from "../entity/trx_region_sucos"; +export * from "../entity/trx_registration"; diff --git a/src/types/trx.ts b/src/types/trx.ts new file mode 100644 index 0000000..7ce2b3e --- /dev/null +++ b/src/types/trx.ts @@ -0,0 +1,8 @@ +export enum TrxTransactionStatusType { + "verify" = "verify", + "open" = "open", + "progress" = "progress", + "close" = "close", + "reject" = "reject", + "approved" = "approved", +}