diff --git a/src/entity/administrativu.ts b/src/entity/administrativu.ts index 98ac22f..4c29028 100644 --- a/src/entity/administrativu.ts +++ b/src/entity/administrativu.ts @@ -9,13 +9,13 @@ export class Administrativu { @Column({ nullable: false, - length: 32 + length: 128 }) code: string; @Column({ nullable: false, - length: 128 + length: 256 }) name: string; diff --git a/src/entity/aldeia.ts b/src/entity/aldeia.ts index a8cd493..4949ef8 100644 --- a/src/entity/aldeia.ts +++ b/src/entity/aldeia.ts @@ -9,13 +9,13 @@ export class Aldeia { @Column({ nullable: false, - length: 32 + length: 128 }) code: string; @Column({ nullable: false, - length: 128 + length: 256 }) name: string; diff --git a/src/entity/cif_account.ts b/src/entity/cif_account.ts index 51aefd9..5b026e3 100644 --- a/src/entity/cif_account.ts +++ b/src/entity/cif_account.ts @@ -1,4 +1,13 @@ -import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from 'typeorm'; +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, JoinColumn, ManyToOne } from 'typeorm'; +import { Branch } from './branchs'; +import { Product } from './products'; +import { IncomeTier } from './income_tier'; +import { ClassEconomi } from './class_economi'; +import { District } from './district'; +import { Munisipo } from './munisipo'; +import { Administrativu } from './administrativu'; +import { Suco } from './suco'; +import { Aldeia } from './aldeia'; @Entity('cif_account') export class CifAccount { @@ -23,34 +32,18 @@ export class CifAccount { }) account_number: string; - @Column({ - nullable: true, - length: 128 - }) - branch_code: string; - - @Column({ - nullable: true, - length: 128 - }) - branch_name: string; + @ManyToOne(() => Branch, { onDelete: "RESTRICT" }) + @JoinColumn() + branch: Branch @Column({ nullable: true, }) open_date: Date; - @Column({ - type: 'int4', - nullable: true, - }) - product_type: number; - - @Column({ - nullable: true, - length: 256 - }) - product_description: string; + @ManyToOne(() => Product, { onDelete: "RESTRICT" }) + @JoinColumn() + product: Product @Column({ type: 'float8', @@ -76,11 +69,9 @@ export class CifAccount { }) exposed_person_flag: string; - @Column({ - nullable: true, - length: 128 - }) - income_tiering: string; + @ManyToOne(() => IncomeTier, { onDelete: "RESTRICT" }) + @JoinColumn() + income_tier: IncomeTier @Column({ nullable: true, @@ -105,41 +96,29 @@ export class CifAccount { }) birth_date: Date; - @Column({ - // type: 'uuid', - nullable: true, - }) - economic_sub_clasification: string; + @ManyToOne(() => ClassEconomi, { onDelete: "RESTRICT" }) + @JoinColumn() + class_economi: ClassEconomi - @Column({ - // type: 'uuid', - nullable: true, - }) - district: string; + @ManyToOne(() => District, { onDelete: "RESTRICT" }) + @JoinColumn() + district: District - @Column({ - // type: 'uuid', - nullable: true, - }) - munisipiu: string; + @ManyToOne(() => Munisipo, { onDelete: "RESTRICT" }) + @JoinColumn() + munisipiu: Munisipo - @Column({ - // type: 'uuid', - nullable: true, - }) - administrativu: string; + @ManyToOne(() => Administrativu, { onDelete: "RESTRICT" }) + @JoinColumn() + administrativu: Administrativu - @Column({ - // type: 'uuid', - nullable: true, - }) - suco: string; + @ManyToOne(() => Suco, { onDelete: "RESTRICT" }) + @JoinColumn() + suco: Suco - @Column({ - // type: 'uuid', - nullable: true, - }) - aldeia: string; + @ManyToOne(() => Aldeia, { onDelete: "RESTRICT" }) + @JoinColumn() + aldeia: Aldeia @Column() @CreateDateColumn() diff --git a/src/entity/class_economi.ts b/src/entity/class_economi.ts index 13e583d..2a57715 100644 --- a/src/entity/class_economi.ts +++ b/src/entity/class_economi.ts @@ -9,13 +9,13 @@ export class ClassEconomi { @Column({ nullable: false, - length: 32 + length: 256 }) code: string; @Column({ nullable: false, - length: 128 + length: 256 }) name: string; diff --git a/src/entity/district.ts b/src/entity/district.ts index f2cd528..9645765 100644 --- a/src/entity/district.ts +++ b/src/entity/district.ts @@ -9,13 +9,13 @@ export class District { @Column({ nullable: false, - length: 32 + length: 128 }) code: string; @Column({ nullable: false, - length: 128 + length: 256 }) name: string; diff --git a/src/entity/income_tier.ts b/src/entity/income_tier.ts index 7ce829a..4d5c4b7 100644 --- a/src/entity/income_tier.ts +++ b/src/entity/income_tier.ts @@ -9,13 +9,13 @@ export class IncomeTier { @Column({ nullable: false, - length: 32 + length: 128 }) code: string; @Column({ nullable: false, - length: 128 + length: 256 }) name: string; diff --git a/src/entity/lnkolek.ts b/src/entity/lnkolek.ts index 74a9d99..b4726ca 100644 --- a/src/entity/lnkolek.ts +++ b/src/entity/lnkolek.ts @@ -1,20 +1,20 @@ -import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from 'typeorm'; +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, JoinColumn, ManyToOne } from 'typeorm'; +import { Product } from './products'; @Entity('lnkolek') export class LNKOLEK { @PrimaryGeneratedColumn('uuid') id: string; - @Column({ - nullable: false - }) - type: string; + @ManyToOne(() => Product, { onDelete: "RESTRICT" }) + @JoinColumn() + product: Product @Column({ type: 'float', nullable: false }) - rate: string; + rate: number; @Column({ nullable: false, @@ -34,18 +34,6 @@ export class LNKOLEK { }) loan_number: string; - @Column({ - nullable: false, - length: 4 - }) - branch_code: string; - - @Column({ - nullable: true, - length: 128 - }) - branch_name: string; - @Column({ nullable: false, }) @@ -99,13 +87,13 @@ export class LNKOLEK { @Column({ type: 'float', - nullable: false, + nullable: true, }) ppap_percent: number; @Column({ - nullable: false, + nullable: true, }) ppap: string; diff --git a/src/entity/log_pull.ts b/src/entity/log_pull.ts index 797ae41..87a84ca 100644 --- a/src/entity/log_pull.ts +++ b/src/entity/log_pull.ts @@ -19,12 +19,30 @@ export class LogPull { }) filename: string; + @Column({ + nullable: true, + length: 32 + }) + branch_code: string; + + @Column({ + nullable: true, + length: 32 + }) + date_index: string; + @Column({ nullable: false, default: false }) is_file_deleted: boolean; + @Column({ + nullable: true, + type: 'text' + }) + error_log: string; + @Column({ nullable: false, length: 64 @@ -35,6 +53,15 @@ export class LogPull { @CreateDateColumn() created_at: Date; + @Column() + @UpdateDateColumn() + updated_at: Date; + + @Column({ + nullable: true + }) + scheduled_at: Date; + @Column({ nullable: true }) diff --git a/src/entity/munisipo.ts b/src/entity/munisipo.ts index 283c7eb..ba96a8a 100644 --- a/src/entity/munisipo.ts +++ b/src/entity/munisipo.ts @@ -9,13 +9,13 @@ export class Munisipo { @Column({ nullable: false, - length: 32 + length: 128 }) code: string; @Column({ nullable: false, - length: 128 + length: 256 }) name: string; diff --git a/src/entity/suco.ts b/src/entity/suco.ts index 3ff95d6..2c1ffde 100644 --- a/src/entity/suco.ts +++ b/src/entity/suco.ts @@ -9,13 +9,13 @@ export class Suco { @Column({ nullable: false, - length: 32 + length: 128 }) code: string; @Column({ nullable: false, - length: 128 + length: 256 }) name: string; diff --git a/src/entity/trial_balance_branch.ts b/src/entity/trial_balance_branch.ts new file mode 100644 index 0000000..edc6295 --- /dev/null +++ b/src/entity/trial_balance_branch.ts @@ -0,0 +1,89 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, JoinColumn, ManyToOne } from 'typeorm'; +import { Branch } from './branchs'; + +@Entity('trial_balance_branch') +export class TrialBalanceBranch { + @PrimaryGeneratedColumn('uuid') + id: string; + + @Column({ + nullable: false, + length: 64 + }) + ledger: string; + + @ManyToOne(() => Branch, { onDelete: "RESTRICT" }) + @JoinColumn() + branch: Branch + + @Column({ + nullable: true, + length: 256 + }) + description: string; + + @Column({ + nullable: true, + length: 32 + }) + type: string; + + @Column({ + nullable: true, + length: 1 + }) + dc: string; + + @Column({ + type: 'float8', + nullable: false, + }) + initial_balance: number; + + @Column({ + type: 'float8', + nullable: false, + }) + debet_transaction: number; + + @Column({ + type: 'float8', + nullable: false, + }) + credit_transaction: number; + + @Column({ + type: 'float8', + nullable: false, + }) + closing_balance: number; + + @Column({ + type: 'float8', + nullable: false, + }) + closing_balance_eq: number; + + @Column({ + nullable: false, + length: 3 + }) + currency: string; + + @Column({ + nullable: false, + }) + position_date: Date; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column() + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; +} \ No newline at end of file diff --git a/src/entity/trial_balance.ts b/src/entity/trial_balance_consolidation.ts similarity index 82% rename from src/entity/trial_balance.ts rename to src/entity/trial_balance_consolidation.ts index 9acaa8e..8ed13ff 100644 --- a/src/entity/trial_balance.ts +++ b/src/entity/trial_balance_consolidation.ts @@ -1,7 +1,8 @@ -import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from 'typeorm'; +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, JoinColumn, ManyToOne } from 'typeorm'; +import { Branch } from './branchs'; -@Entity('trial_balance') -export class TrialBalance { +@Entity('trial_balance_consolidation') +export class TrialBalanceConsolidation { @PrimaryGeneratedColumn('uuid') id: string; @@ -12,19 +13,19 @@ export class TrialBalance { ledger: string; @Column({ - nullable: false, + nullable: true, length: 256 }) description: string; @Column({ - nullable: false, + nullable: true, length: 32 }) type: string; @Column({ - nullable: false, + nullable: true, length: 1 }) dc: string; diff --git a/src/index.ts b/src/index.ts index 756ceb3..49c0bc7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,7 @@ import { CifAccount } from "./entity/cif_account"; import { LNKOLEK } from "./entity/lnkolek"; -import { TrialBalance } from "./entity/trial_balance"; +import { TrialBalanceBranch } from "./entity/trial_balance_branch"; +import { TrialBalanceConsolidation } from "./entity/trial_balance_consolidation"; import { UserActivity } from "./entity/user_activity"; import { UserRefreshToken } from "./entity/user_refresh_token"; import { User } from "./entity/users"; @@ -29,7 +30,8 @@ export { UserRole, UserActivity, UserRefreshToken, - TrialBalance, + TrialBalanceBranch, + TrialBalanceConsolidation, LNKOLEK, CifAccount, ActivityType,