diff --git a/src/database/migrations/1726033041774-add-pos-name-column.ts b/src/database/migrations/1726033041774-add-pos-name-column.ts new file mode 100644 index 0000000..a557191 --- /dev/null +++ b/src/database/migrations/1726033041774-add-pos-name-column.ts @@ -0,0 +1,21 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class AddPosNameColumn1726033041774 implements MigrationInterface { + name = 'AddPosNameColumn1726033041774'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "transactions" ADD "creator_counter_name" character varying`, + ); + await queryRunner.query( + `ALTER TABLE "logs_pos" ADD "pos_name" character varying`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "logs_pos" DROP COLUMN "pos_name"`); + await queryRunner.query( + `ALTER TABLE "transactions" DROP COLUMN "creator_counter_name"`, + ); + } +} diff --git a/src/modules/configuration/log/data/models/pos-log.model.ts b/src/modules/configuration/log/data/models/pos-log.model.ts index fd8631f..2d09858 100644 --- a/src/modules/configuration/log/data/models/pos-log.model.ts +++ b/src/modules/configuration/log/data/models/pos-log.model.ts @@ -14,6 +14,9 @@ export class PosLogModel @Column('bigint', { name: 'pos_number', nullable: true }) pos_number: number; + @Column('varchar', { name: 'pos_name', nullable: true }) + pos_name: string; + @Column('decimal', { name: 'total_balance', nullable: true }) total_balance: number; diff --git a/src/modules/configuration/log/domain/entities/pos-log.entity.ts b/src/modules/configuration/log/domain/entities/pos-log.entity.ts index f29f780..360e071 100644 --- a/src/modules/configuration/log/domain/entities/pos-log.entity.ts +++ b/src/modules/configuration/log/domain/entities/pos-log.entity.ts @@ -3,6 +3,7 @@ import { BaseCoreEntity } from 'src/core/modules/domain/entities/base-core.entit export interface PosLogEntity extends BaseCoreEntity { type: PosLogType; pos_number: number; + pos_name: string; total_balance: number; created_at: number; creator_name: string; diff --git a/src/modules/configuration/log/domain/handlers/pos-log.handler.ts b/src/modules/configuration/log/domain/handlers/pos-log.handler.ts index 192247f..db7c944 100644 --- a/src/modules/configuration/log/domain/handlers/pos-log.handler.ts +++ b/src/modules/configuration/log/domain/handlers/pos-log.handler.ts @@ -26,6 +26,7 @@ export class RecordPosLogHandler implements IEventHandler { type: PosLogType[data.type], total_balance: data.withdrawal_cash ?? data.opening_cash_balance, pos_number: data.pos_number, + pos_name: data.pos_name, creator_id: data.pos_admin?.id, creator_name: data.pos_admin?.name ?? data.pos_admin?.username, drawn_by_id: data.withdraw_user?.id, diff --git a/src/modules/transaction/reconciliation/domain/usecases/managers/index-reconciliation.manager.ts b/src/modules/transaction/reconciliation/domain/usecases/managers/index-reconciliation.manager.ts index 062c49f..a3d7a0b 100644 --- a/src/modules/transaction/reconciliation/domain/usecases/managers/index-reconciliation.manager.ts +++ b/src/modules/transaction/reconciliation/domain/usecases/managers/index-reconciliation.manager.ts @@ -47,6 +47,7 @@ export class IndexReconciliationManager extends BaseIndexManager `${this.tableName}.status`, `${this.tableName}.invoice_code`, `${this.tableName}.creator_counter_no`, + `${this.tableName}.creator_counter_name`, `${this.tableName}.booking_date`, `${this.tableName}.no_of_group`, `${this.tableName}.type`,