mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2026-10-23 08:47:57 +00:00
feat: send the adress data to noleap
This commit is contained in:
@@ -93,25 +93,27 @@ export class NeoLeapService {
|
|||||||
incomeSource: dto.incomeSource,
|
incomeSource: dto.incomeSource,
|
||||||
jobCategory: dto.jobCategory,
|
jobCategory: dto.jobCategory,
|
||||||
incomeRange: dto.incomeRange,
|
incomeRange: dto.incomeRange,
|
||||||
// Send empty address strings (Neoleap doesn't validate content)
|
// Map collected address fields to Neoleap's format
|
||||||
address: {
|
address: {
|
||||||
national: {
|
national: {
|
||||||
buildingNumber: '',
|
buildingNumber: dto.building || '',
|
||||||
additionalNumber: '',
|
additionalNumber: '',
|
||||||
street: '',
|
street: dto.street || '',
|
||||||
streetEn: '',
|
streetEn: dto.street || '',
|
||||||
city: '',
|
city: dto.city || '',
|
||||||
cityEn: '',
|
cityEn: dto.city || '',
|
||||||
zipcode: '',
|
zipcode: '',
|
||||||
unitNumber: '',
|
unitNumber: '',
|
||||||
district: '',
|
district: dto.neighborhood || '',
|
||||||
districtEn: '',
|
districtEn: dto.neighborhood || '',
|
||||||
},
|
},
|
||||||
general: {
|
general: {
|
||||||
address: '',
|
address: [dto.building, dto.street, dto.neighborhood, dto.city, dto.region]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(', '),
|
||||||
website: '',
|
website: '',
|
||||||
email: '',
|
email: dto.email || '',
|
||||||
telephone1: '',
|
telephone1: dto.mobileNumber || '',
|
||||||
telephone2: '',
|
telephone2: '',
|
||||||
fax1: '',
|
fax1: '',
|
||||||
fax2: '',
|
fax2: '',
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class AddNationalIdToKycTransactions1765877128065 implements MigrationInterface {
|
||||||
|
name = 'AddNationalIdToKycTransactions1765877128065'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
// Add column as nullable first (to handle existing records)
|
||||||
|
await queryRunner.query(`ALTER TABLE "kyc_transactions" ADD "national_id" character varying(50)`);
|
||||||
|
|
||||||
|
// Backfill existing records from form_data->poiNumber
|
||||||
|
await queryRunner.query(`
|
||||||
|
UPDATE "kyc_transactions"
|
||||||
|
SET "national_id" = form_data->>'poiNumber'
|
||||||
|
WHERE "national_id" IS NULL AND form_data->>'poiNumber' IS NOT NULL
|
||||||
|
`);
|
||||||
|
|
||||||
|
// Now make it NOT NULL with a default empty string for safety
|
||||||
|
await queryRunner.query(`ALTER TABLE "kyc_transactions" ALTER COLUMN "national_id" SET DEFAULT ''`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "kyc_transactions" ALTER COLUMN "national_id" SET NOT NULL`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "kyc_transactions" DROP COLUMN "national_id"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user