diff --git a/services/121-service/src/migration/1708330965061-migrate-data-changes-to-event.ts b/services/121-service/src/migration/1708330965061-migrate-data-changes-to-event.ts index 3a2c9e6f52..57c1c8c3b4 100644 --- a/services/121-service/src/migration/1708330965061-migrate-data-changes-to-event.ts +++ b/services/121-service/src/migration/1708330965061-migrate-data-changes-to-event.ts @@ -31,7 +31,6 @@ export class MigrateDataChangesToEvent1708330965061 await queryRunner.query( `DROP INDEX "121-service"."IDX_5c7356500932acbd5f76a787ce"`, ); - console.time('migrateData'); const manager = queryRunner.manager; const eventRepo = manager.getRepository(EventEntity); const keysToMigrate = ['fieldName', 'oldValue', 'newValue', 'reason']; @@ -70,6 +69,5 @@ export class MigrateDataChangesToEvent1708330965061 await queryRunner.query( `DROP TABLE IF EXISTS "121-service".registration_change_log `, ); - console.timeEnd('migrateData'); } } diff --git a/services/121-service/src/migration/1708330966062-migrate-status-changes-to-event.ts b/services/121-service/src/migration/1708330966062-migrate-status-changes-to-event.ts index a878a0d482..a6337adfb1 100644 --- a/services/121-service/src/migration/1708330966062-migrate-status-changes-to-event.ts +++ b/services/121-service/src/migration/1708330966062-migrate-status-changes-to-event.ts @@ -25,7 +25,6 @@ export class MigrateStatusChangesToEvent1708330966062 public async down(_queryRunner: QueryRunner): Promise {} private async migrateStatusChanges(queryRunner: QueryRunner): Promise { - console.time('migrateStatusChanges'); const manager = queryRunner.manager; const eventRepo = manager.getRepository(EventEntity); const adminUser = await queryRunner.query( @@ -75,6 +74,5 @@ export class MigrateStatusChangesToEvent1708330966062 }); await eventRepo.save(events, { chunk: 300 }); - console.timeEnd('migrateStatusChanges'); } } diff --git a/services/121-service/src/migration/1713363871246-remove-startedRegistration-state.ts b/services/121-service/src/migration/1713363871246-remove-startedRegistration-state.ts index 9454e34b32..72a796b168 100644 --- a/services/121-service/src/migration/1713363871246-remove-startedRegistration-state.ts +++ b/services/121-service/src/migration/1713363871246-remove-startedRegistration-state.ts @@ -8,7 +8,6 @@ export class RemoveStartedRegistrationState1713363871246 name = 'RemoveStartedRegistrationState1713363871246'; public async up(queryRunner: QueryRunner): Promise { - console.time('RemoveStartedRegistrationState1713363871246'); await queryRunner.commitTransaction(); await queryRunner.query(`DELETE FROM "121-service".note WHERE "registrationId" IN @@ -32,7 +31,6 @@ export class RemoveStartedRegistrationState1713363871246 ); await queryRunner.startTransaction(); - console.timeEnd('RemoveStartedRegistrationState1713363871246'); } // eslint-disable-next-line @typescript-eslint/no-empty-function diff --git a/services/121-service/src/migration/1714467563401-remove-deleted-state-from-registration.ts b/services/121-service/src/migration/1714467563401-remove-deleted-state-from-registration.ts index d0e39f1a31..81c790408c 100644 --- a/services/121-service/src/migration/1714467563401-remove-deleted-state-from-registration.ts +++ b/services/121-service/src/migration/1714467563401-remove-deleted-state-from-registration.ts @@ -6,7 +6,6 @@ export class RemoveDeletedStateFromRegistration1714467563401 name = 'RemoveDeletedStateFromRegistration1714467563401'; public async up(queryRunner: QueryRunner): Promise { - console.time('RemoveDeletedStateFromRegistration1714467563401'); await queryRunner.commitTransaction(); const queryCondition = `"fspId" is null AND "registrationStatus" = 'deleted'`; @@ -44,7 +43,6 @@ export class RemoveDeletedStateFromRegistration1714467563401 ); await queryRunner.startTransaction(); - console.timeEnd('RemoveDeletedStateFromRegistration1714467563401'); } // eslint-disable-next-line @typescript-eslint/no-empty-function diff --git a/services/121-service/src/scripts/seed-mock-helpers.ts b/services/121-service/src/scripts/seed-mock-helpers.ts index 0360ed46d2..fb17928ab2 100644 --- a/services/121-service/src/scripts/seed-mock-helpers.ts +++ b/services/121-service/src/scripts/seed-mock-helpers.ts @@ -267,7 +267,15 @@ export class SeedMockHelper { for (const table of tables) { const tableName = table.table_name; if (!['custom_migration', 'typeorm_metadata'].includes(tableName)) { - const sequenceName = `${tableName}_id_seq`; + let sequenceName = `${tableName}_id_seq`; + // this sequences is created with an abbreviated name automatically, so this exception is needed here + if ( + tableName === + 'program_financial_service_provider_configuration_property' + ) { + sequenceName = 'program_financial_service_pro_id_seq'; + } + const maxIdQuery = `SELECT MAX(id) FROM "121-service"."${tableName}"`; const maxIdResult = await this.dataSource.query(maxIdQuery); diff --git a/services/121-service/src/scripts/sql/mock-intersolve-voucher-attributes.sql b/services/121-service/src/scripts/sql/mock-intersolve-voucher-attributes.sql index 050a500f2f..86a93c81d4 100644 --- a/services/121-service/src/scripts/sql/mock-intersolve-voucher-attributes.sql +++ b/services/121-service/src/scripts/sql/mock-intersolve-voucher-attributes.sql @@ -1,13 +1,14 @@ WITH fsp_data AS ( - SELECT fa.id - FROM "121-service".financial_service_provider_question fa - LEFT JOIN "121-service".financial_service_provider f ON f.id = fa."fspId" - WHERE "name" = 'whatsappPhoneNumber' AND f.fsp = 'Intersolve-voucher-whatsapp' + SELECT pra.id + FROM "121-service".program_registration_attribute pra + LEFT JOIN "121-service".program p ON p.id = pra."programId" + LEFT JOIN "121-service".program_financial_service_provider_configuration f ON f."programId" = p.id + WHERE pra."name" = 'whatsappPhoneNumber' AND f."financialServiceProviderName" = 'Intersolve-voucher-whatsapp' ) UPDATE "121-service".intersolve_voucher iv SET "whatsappPhoneNumber" = rd."value" FROM "121-service".imagecode_export_vouchers iev LEFT JOIN "121-service".registration r ON r.id = iev."registrationId" -LEFT JOIN "121-service".registration_data rd ON r.id = rd."registrationId", fsp_data fd -WHERE iv.id = iev."voucherId" AND rd."fspQuestionId" = fd.id; +LEFT JOIN "121-service".registration_attribute_data rd ON r.id = rd."registrationId", fsp_data fd +WHERE iv.id = iev."voucherId" AND rd."programRegistrationAttributeId" = fd.id; diff --git a/services/121-service/src/scripts/sql/mock-make-phone-unique.sql b/services/121-service/src/scripts/sql/mock-make-phone-unique.sql index 9fe5bcb24b..2ace1bb3ee 100644 --- a/services/121-service/src/scripts/sql/mock-make-phone-unique.sql +++ b/services/121-service/src/scripts/sql/mock-make-phone-unique.sql @@ -1,9 +1,9 @@ -update "121-service".registration_data +update "121-service".registration_attribute_data set "value" = CAST(10000000000 + floor(random() * 90000000000) AS bigint) - WHERE "programQuestionId" IN (SELECT id FROM "121-service".program_question WHERE "name" = 'phoneNumber') OR "fspQuestionId" IN (SELECT id FROM "121-service".financial_service_provider_question WHERE "name" = 'whatsappPhoneNumber'); + WHERE "programRegistrationAttributeId" IN (SELECT id FROM "121-service".program_registration_attribute WHERE "name" = 'phoneNumber' OR "name" = 'whatsappPhoneNumber'); ; update "121-service".registration r set "phoneNumber" = rd."value" - from "121-service".registration_data rd - where rd."registrationId" = r."id" and rd."programQuestionId" in (SELECT id FROM "121-service".program_question WHERE "name" = 'phoneNumber') + from "121-service".registration_attribute_data rd + where rd."registrationId" = r."id" and rd."programRegistrationAttributeId" in (SELECT id FROM "121-service".program_registration_attribute WHERE "name" = 'phoneNumber') ; diff --git a/services/121-service/src/scripts/sql/mock-payment-transactions.sql b/services/121-service/src/scripts/sql/mock-payment-transactions.sql index 3b0a8461b4..2a83dfbefa 100644 --- a/services/121-service/src/scripts/sql/mock-payment-transactions.sql +++ b/services/121-service/src/scripts/sql/mock-payment-transactions.sql @@ -7,11 +7,11 @@ INSERT INTO "121-service"."transaction" "customData", "transactionStep", "programId", - "financialServiceProviderId", "registrationId", amount, updated, - "userId" + "userId", + "programFinancialServiceProviderConfigurationId" ) SELECT created + INTERVAL '1 millisecond' * ROW_NUMBER() OVER (ORDER BY id), @@ -21,11 +21,11 @@ SELECT "customData", "transactionStep", "programId", - "financialServiceProviderId", "registrationId", amount, updated, - "userId" + "userId", + "programFinancialServiceProviderConfigurationId" FROM "121-service"."transaction" WHERE diff --git a/services/121-service/src/scripts/sql/mock-registration-data.sql b/services/121-service/src/scripts/sql/mock-registration-data.sql index 82884bf976..b16ff26931 100644 --- a/services/121-service/src/scripts/sql/mock-registration-data.sql +++ b/services/121-service/src/scripts/sql/mock-registration-data.sql @@ -1,22 +1,20 @@ INSERT INTO - "121-service"."registration_data" ( + "121-service"."registration_attribute_data" ( SELECT id + ( SELECT max(id) FROM - "121-service"."registration_data") AS id, + "121-service"."registration_attribute_data") AS id, created, + updated, "registrationId" + ( SELECT max("registrationId") FROM - "121-service"."registration_data") AS "registrationId", - "programQuestionId", - "fspQuestionId", - "programCustomAttributeId", - value, - updated + "121-service"."registration_attribute_data") AS "registrationId", + "programRegistrationAttributeId", + value FROM - "121-service"."registration_data"); + "121-service"."registration_attribute_data"); diff --git a/services/121-service/src/scripts/sql/mock-registrations.sql b/services/121-service/src/scripts/sql/mock-registrations.sql index 4e041545a6..4b239cf7a9 100644 --- a/services/121-service/src/scripts/sql/mock-registrations.sql +++ b/services/121-service/src/scripts/sql/mock-registrations.sql @@ -16,7 +16,6 @@ INSERT "paymentAmountMultiplier", "programId", "userId", - "programFinancialServiceProviderConfigurationId", updated, "registrationProgramId" + ( SELECT @@ -32,6 +31,7 @@ INSERT ELSE 'zeeland.goes' END ELSE scope - END + END, + "programFinancialServiceProviderConfigurationId" FROM "121-service".registration); diff --git a/services/121-service/src/scripts/sql/mock-transations-one-per-registrations.sql b/services/121-service/src/scripts/sql/mock-transations-one-per-registrations.sql index bc55d129da..79e2bf3c46 100644 --- a/services/121-service/src/scripts/sql/mock-transations-one-per-registrations.sql +++ b/services/121-service/src/scripts/sql/mock-transations-one-per-registrations.sql @@ -6,11 +6,11 @@ INSERT INTO "121-service"."transaction" ( "customData", "transactionStep", "programId", - "financialServiceProviderId", "registrationId", amount, updated, - "userId" + "userId", + "programFinancialServiceProviderConfigurationId" ) SELECT created + INTERVAL '1 millisecond' * ROW_NUMBER() OVER (ORDER BY id), @@ -20,11 +20,11 @@ SELECT "customData", "transactionStep", "programId", - "financialServiceProviderId", "registrationId" + (SELECT max("registrationId") FROM "121-service"."transaction"), amount, updated, - "userId" + "userId", + "programFinancialServiceProviderConfigurationId" FROM "121-service"."transaction" WHERE diff --git a/services/121-service/src/scripts/sql/mock-visa-customers.sql b/services/121-service/src/scripts/sql/mock-visa-customers.sql index f0d2877b3a..110e60f01c 100644 --- a/services/121-service/src/scripts/sql/mock-visa-customers.sql +++ b/services/121-service/src/scripts/sql/mock-visa-customers.sql @@ -9,5 +9,5 @@ INSERT ,'mock-holderId' ,r.id from "121-service".registration r - left join "121-service".financial_service_provider f on r."fspId" = f.id - where f.fsp = 'Intersolve-visa'); \ No newline at end of file + left join "121-service".program_financial_service_provider_configuration f on r."programFinancialServiceProviderConfigurationId" = f.id + where f."financialServiceProviderName" = 'Intersolve-visa'); \ No newline at end of file diff --git a/services/121-service/src/seed-data/mock/registration-pv.data.ts b/services/121-service/src/seed-data/mock/registration-pv.data.ts index b9906edb86..e3fc2f8a8d 100644 --- a/services/121-service/src/seed-data/mock/registration-pv.data.ts +++ b/services/121-service/src/seed-data/mock/registration-pv.data.ts @@ -9,7 +9,8 @@ export const registrationAHWhatsapp = { fullName: 'Juan Garcia', scope: 'utrecht.houten', [DefaultRegistrationDataAttributeNames.phoneNumber]: '14155238888', - fspName: FinancialServiceProviders.intersolveVoucherWhatsapp, + programFinancialServiceProviderConfigurationName: + FinancialServiceProviders.intersolveVoucherWhatsapp, [DefaultRegistrationDataAttributeNames.whatsappPhoneNumber]: '14155238888', namePartnerOrganization: 'Help Elkaar', };