diff --git a/src/common/modules/neoleap/__mocks__/kyc-callback.mock.ts b/src/common/modules/neoleap/__mocks__/kyc-callback.mock.ts index 88d4e5b..3bd6b45 100644 --- a/src/common/modules/neoleap/__mocks__/kyc-callback.mock.ts +++ b/src/common/modules/neoleap/__mocks__/kyc-callback.mock.ts @@ -17,7 +17,6 @@ export const getKycCallbackMock = (nationalId: string) => { salaryMax: '1000', incomeSource: 'Salary', professionTitle: 'Software Engineer', - professionType: 'Full-Time', isPep: 'N', country: '682', region: 'Mecca', diff --git a/src/customer/dtos/response/customer.response.dto.ts b/src/customer/dtos/response/customer.response.dto.ts index 82bfe91..3ed0423 100644 --- a/src/customer/dtos/response/customer.response.dto.ts +++ b/src/customer/dtos/response/customer.response.dto.ts @@ -34,15 +34,6 @@ export class CustomerResponseDto { @ApiProperty({ example: 'JO' }) countryOfResidence!: string; - @ApiProperty({ example: 'Employee' }) - sourceOfIncome!: string; - - @ApiProperty({ example: 'Software Development' }) - profession!: string; - - @ApiProperty({ example: 'Full-time' }) - professionType!: string; - @ApiProperty({ example: false }) isPep!: boolean; @@ -90,9 +81,6 @@ export class CustomerResponseDto { this.nationalId = customer.nationalId; this.nationalIdExpiry = customer.nationalIdExpiry; this.countryOfResidence = customer.countryOfResidence; - this.sourceOfIncome = customer.sourceOfIncome; - this.profession = customer.profession; - this.professionType = customer.professionType; this.isPep = customer.isPep; this.gender = customer.gender; this.isJunior = customer.isJunior; diff --git a/src/customer/entities/customer.entity.ts b/src/customer/entities/customer.entity.ts index cd263ae..ae381ae 100644 --- a/src/customer/entities/customer.entity.ts +++ b/src/customer/entities/customer.entity.ts @@ -49,15 +49,6 @@ export class Customer extends BaseEntity { @Column('varchar', { length: 255, nullable: true, name: 'country_of_residence' }) countryOfResidence!: CountryIso; - @Column('varchar', { length: 255, nullable: true, name: 'source_of_income' }) - sourceOfIncome!: string; - - @Column('varchar', { length: 255, nullable: true, name: 'profession' }) - profession!: string; - - @Column('varchar', { length: 255, nullable: true, name: 'profession_type' }) - professionType!: string; - @Column('boolean', { default: false, name: 'is_pep' }) isPep!: boolean; diff --git a/src/db/migrations/1765891028260-RemoveOldCustomerColumns.ts b/src/db/migrations/1765891028260-RemoveOldCustomerColumns.ts new file mode 100644 index 0000000..46f0948 --- /dev/null +++ b/src/db/migrations/1765891028260-RemoveOldCustomerColumns.ts @@ -0,0 +1,23 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class RemoveOldCustomerColumns1765891028260 implements MigrationInterface { + name = 'RemoveOldCustomerColumns1765891028260'; + + public async up(queryRunner: QueryRunner): Promise { + // Remove duplicate/unused columns that were replaced by KYC-specific fields + // source_of_income -> replaced by income_source + // profession -> replaced by job_sector + // profession_type -> replaced by job_category + await queryRunner.query(`ALTER TABLE "customers" DROP COLUMN IF EXISTS "source_of_income"`); + await queryRunner.query(`ALTER TABLE "customers" DROP COLUMN IF EXISTS "profession"`); + await queryRunner.query(`ALTER TABLE "customers" DROP COLUMN IF EXISTS "profession_type"`); + } + + public async down(queryRunner: QueryRunner): Promise { + // Restore columns if migration is rolled back + await queryRunner.query(`ALTER TABLE "customers" ADD "source_of_income" character varying(255)`); + await queryRunner.query(`ALTER TABLE "customers" ADD "profession" character varying(255)`); + await queryRunner.query(`ALTER TABLE "customers" ADD "profession_type" character varying(255)`); + } +} + diff --git a/src/db/migrations/index.ts b/src/db/migrations/index.ts index 304fdd0..9816012 100644 --- a/src/db/migrations/index.ts +++ b/src/db/migrations/index.ts @@ -7,4 +7,5 @@ export * from './1757915357218-add-deleted-at-column-to-junior'; export * from './1760869651296-AddMerchantInfoToTransactions'; export * from './1761032305682-AddUniqueConstraintToUserEmail'; export * from './1765804942393-AddKycFieldsAndTransactions'; -export * from './1765877128065-AddNationalIdToKycTransactions'; \ No newline at end of file +export * from './1765877128065-AddNationalIdToKycTransactions'; +export * from './1765891028260-RemoveOldCustomerColumns'; \ No newline at end of file