Merge pull request #68 from Zod-Alkhair/feature/kyc-onboarding

refactor: remove obsolete customer fields and update migration
This commit is contained in:
Majdalkilany0
2025-12-16 16:42:30 +03:00
committed by GitHub
5 changed files with 25 additions and 23 deletions

View File

@ -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',

View File

@ -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;

View File

@ -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;

View File

@ -0,0 +1,23 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class RemoveOldCustomerColumns1765891028260 implements MigrationInterface {
name = 'RemoveOldCustomerColumns1765891028260';
public async up(queryRunner: QueryRunner): Promise<void> {
// 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<void> {
// 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)`);
}
}

View File

@ -8,3 +8,4 @@ export * from './1760869651296-AddMerchantInfoToTransactions';
export * from './1761032305682-AddUniqueConstraintToUserEmail';
export * from './1765804942393-AddKycFieldsAndTransactions';
export * from './1765877128065-AddNationalIdToKycTransactions';
export * from './1765891028260-RemoveOldCustomerColumns';