From 5f8e6d68f75439662dca84b4ed834fbf443a2fdf Mon Sep 17 00:00:00 2001 From: Andrew Boni Signori <61259237+andrewsignori-aot@users.noreply.github.com> Date: Tue, 8 Oct 2024 16:35:56 -0700 Subject: [PATCH] #3623 - SFAS-SIMS Bridge File - Update layout and Insert PT MSFAA info (#3775) - Created the new MSFAA columns. - Used the same DB type already in place for the existing full-time MSFAA. - Updated the entity model to reflect the DB type. - Adjusted an E2E file to one individual with part-time data. ### Rollback ![image](https://github.com/user-attachments/assets/5ff95ca2-cfd2-4ed5-b51c-7240c577a78f) --- ...66-SFAStoSIMSBridgePartTimeMSFAAColumns.ts | 21 +++++++++++++++++++ .../Add-part-time-msfaa-columns.sql | 10 +++++++++ .../Rollback-add-part-time-msfaa-columns.sql | 3 +++ .../SFAS-TO-SIMS-VALID-INDIVIDUAL-RECORDS.txt | 4 ++-- .../sfas-integration.scheduler.e2e-spec.ts | 12 +++++++++-- .../services/sfas/sfas-individual.service.ts | 7 ++++++- .../sfas-files/sfas-individual-record.ts | 12 +++++++++++ .../src/entities/sfas-individual.model.ts | 19 ++++++++++++++++- 8 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 sources/packages/backend/apps/db-migrations/src/migrations/1728416893266-SFAStoSIMSBridgePartTimeMSFAAColumns.ts create mode 100644 sources/packages/backend/apps/db-migrations/src/sql/SFASIndividuals/Add-part-time-msfaa-columns.sql create mode 100644 sources/packages/backend/apps/db-migrations/src/sql/SFASIndividuals/Rollback-add-part-time-msfaa-columns.sql diff --git a/sources/packages/backend/apps/db-migrations/src/migrations/1728416893266-SFAStoSIMSBridgePartTimeMSFAAColumns.ts b/sources/packages/backend/apps/db-migrations/src/migrations/1728416893266-SFAStoSIMSBridgePartTimeMSFAAColumns.ts new file mode 100644 index 0000000000..ee2c7f41d1 --- /dev/null +++ b/sources/packages/backend/apps/db-migrations/src/migrations/1728416893266-SFAStoSIMSBridgePartTimeMSFAAColumns.ts @@ -0,0 +1,21 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; +import { getSQLFileData } from "../utilities/sqlLoader"; + +export class SFAStoSIMSBridgePartTimeMSFAAColumns1728416893266 + implements MigrationInterface +{ + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + getSQLFileData("Add-part-time-msfaa-columns.sql", "SFASIndividuals"), + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + getSQLFileData( + "Rollback-add-part-time-msfaa-columns.sql", + "SFASIndividuals", + ), + ); + } +} diff --git a/sources/packages/backend/apps/db-migrations/src/sql/SFASIndividuals/Add-part-time-msfaa-columns.sql b/sources/packages/backend/apps/db-migrations/src/sql/SFASIndividuals/Add-part-time-msfaa-columns.sql new file mode 100644 index 0000000000..978526f5ab --- /dev/null +++ b/sources/packages/backend/apps/db-migrations/src/sql/SFASIndividuals/Add-part-time-msfaa-columns.sql @@ -0,0 +1,10 @@ +ALTER TABLE + sims.sfas_individuals +ADD + COLUMN part_time_msfaa_number CHAR(10), +ADD + COLUMN part_time_msfaa_effective_date DATE; + +COMMENT ON COLUMN sims.sfas_individuals.part_time_msfaa_number IS 'The most recent Part-time Master Student Loan Agreement Number (agreement_num.sail_msfaa_numbers).'; + +COMMENT ON COLUMN sims.sfas_individuals.part_time_msfaa_effective_date IS 'The most recent Part-time Master Student Loan Agreement effective date (effective_date.sail_msfaa_numbers).'; \ No newline at end of file diff --git a/sources/packages/backend/apps/db-migrations/src/sql/SFASIndividuals/Rollback-add-part-time-msfaa-columns.sql b/sources/packages/backend/apps/db-migrations/src/sql/SFASIndividuals/Rollback-add-part-time-msfaa-columns.sql new file mode 100644 index 0000000000..07199d76f9 --- /dev/null +++ b/sources/packages/backend/apps/db-migrations/src/sql/SFASIndividuals/Rollback-add-part-time-msfaa-columns.sql @@ -0,0 +1,3 @@ +ALTER TABLE + sims.sfas_individuals DROP COLUMN part_time_msfaa_number, + DROP COLUMN part_time_msfaa_effective_date; \ No newline at end of file diff --git a/sources/packages/backend/apps/queue-consumers/src/processors/schedulers/sfas-integration/_tests_/sfas-files/SFAS-TO-SIMS-VALID-INDIVIDUAL-RECORDS.txt b/sources/packages/backend/apps/queue-consumers/src/processors/schedulers/sfas-integration/_tests_/sfas-files/SFAS-TO-SIMS-VALID-INDIVIDUAL-RECORDS.txt index e77fcda226..42660a85cb 100644 --- a/sources/packages/backend/apps/queue-consumers/src/processors/schedulers/sfas-integration/_tests_/sfas-files/SFAS-TO-SIMS-VALID-INDIVIDUAL-RECORDS.txt +++ b/sources/packages/backend/apps/queue-consumers/src/processors/schedulers/sfas-integration/_tests_/sfas-files/SFAS-TO-SIMS-VALID-INDIVIDUAL-RECORDS.txt @@ -1,5 +1,5 @@ 100AESTSFAS TO SIMS BRIDGE 20240709110630 2000000083540000000000083540GIORGIO GIOVANNI 19660721121380174Y19660721Y1967072298765432102024071276543210010000005000000000500000007560500000756050000007413000000741300000074130000007413000000000020000000017 -2000000083541000000000083541GIORGIO GIOVANNI 19491116108796293N N 98765432112024071376543220020000005000000000500000011040000001104000000110400000011040000001104000000110400000000000020000000002 -2000000083542000000000083542GIORGIO GIOVANNI 19700702122886591 00000000000000000000000000000000000000000000000000000000000000000000000000000000011039000000000000000000000000000000000000000000 +2000000083541000000000083541GIORGIO GIOVANNI 19491116108796293N N 98765432112024071376543220020000005000000000500000011040000001104000000110400000011040000001104000000110400000000000020000000002123456789020241231 +2000000083542000000000083542GIORGIO GIOVANNI 19700702122886591 00000000000000000000000000000000000000000000000000000000000000000000000000000000011039000000000000000000000000000000000000000000 999000048090000009580094900 \ No newline at end of file diff --git a/sources/packages/backend/apps/queue-consumers/src/processors/schedulers/sfas-integration/_tests_/sfas-integration.scheduler.e2e-spec.ts b/sources/packages/backend/apps/queue-consumers/src/processors/schedulers/sfas-integration/_tests_/sfas-integration.scheduler.e2e-spec.ts index 6978832f8a..04624e3105 100644 --- a/sources/packages/backend/apps/queue-consumers/src/processors/schedulers/sfas-integration/_tests_/sfas-integration.scheduler.e2e-spec.ts +++ b/sources/packages/backend/apps/queue-consumers/src/processors/schedulers/sfas-integration/_tests_/sfas-integration.scheduler.e2e-spec.ts @@ -330,6 +330,8 @@ describe(describeProcessorRootTest(QueueNames.SFASIntegration), () => { grantOveraward: true, withdrawals: true, unsuccessfulCompletion: true, + partTimeMSFAANumber: true, + partTimeMSFAAEffectiveDate: true, }, where: { id: In([83540, 83541, 83542]), @@ -348,7 +350,7 @@ describe(describeProcessorRootTest(QueueNames.SFASIntegration), () => { pdStatus: true, ppdStatus: true, ppdStatusDate: "1967-07-22", - msfaaNumber: 9876543210, + msfaaNumber: "9876543210", msfaaSignedDate: "2024-07-12", neb: 5000, bcgg: 5000, @@ -360,6 +362,8 @@ describe(describeProcessorRootTest(QueueNames.SFASIntegration), () => { grantOveraward: 741.3, withdrawals: 2, unsuccessfulCompletion: 17, + partTimeMSFAANumber: null, + partTimeMSFAAEffectiveDate: null, }); expect(secondSFASIndividual).toEqual({ id: 83541, @@ -370,7 +374,7 @@ describe(describeProcessorRootTest(QueueNames.SFASIntegration), () => { pdStatus: false, ppdStatus: false, ppdStatusDate: null, - msfaaNumber: 9876543211, + msfaaNumber: "9876543211", msfaaSignedDate: "2024-07-13", neb: 5000, bcgg: 5000, @@ -382,6 +386,8 @@ describe(describeProcessorRootTest(QueueNames.SFASIntegration), () => { grantOveraward: 11040, withdrawals: 2, unsuccessfulCompletion: 2, + partTimeMSFAANumber: "1234567890", + partTimeMSFAAEffectiveDate: "2024-12-31", }); expect(thirdSFASIndividual).toEqual({ id: 83542, @@ -404,6 +410,8 @@ describe(describeProcessorRootTest(QueueNames.SFASIntegration), () => { grantOveraward: 0, withdrawals: null, unsuccessfulCompletion: 0, + partTimeMSFAANumber: null, + partTimeMSFAAEffectiveDate: null, }); }, ); diff --git a/sources/packages/backend/libs/integrations/src/services/sfas/sfas-individual.service.ts b/sources/packages/backend/libs/integrations/src/services/sfas/sfas-individual.service.ts index b096cb00c4..e02429c7d5 100644 --- a/sources/packages/backend/libs/integrations/src/services/sfas/sfas-individual.service.ts +++ b/sources/packages/backend/libs/integrations/src/services/sfas/sfas-individual.service.ts @@ -72,7 +72,7 @@ export class SFASIndividualService individual.ppdStatusDate = getISODateOnlyString( sfasIndividual.ppdStatusDate, ); - individual.msfaaNumber = sfasIndividual.msfaaNumber; + individual.msfaaNumber = sfasIndividual.msfaaNumber?.toString(); individual.msfaaSignedDate = getISODateOnlyString( sfasIndividual.msfaaSignedDate, ); @@ -87,6 +87,11 @@ export class SFASIndividualService individual.withdrawals = sfasIndividual.withdrawals; individual.unsuccessfulCompletion = sfasIndividual.unsuccessfulCompletion; individual.extractedAt = getUTC(extractedDate); + individual.partTimeMSFAANumber = + sfasIndividual.partTimeMSFAANumber?.toString(); + individual.partTimeMSFAAEffectiveDate = getISODateOnlyString( + sfasIndividual.partTimeMSFAAEffectiveDate, + ); await this.repo.save(individual, { reload: false, transaction: false }); } diff --git a/sources/packages/backend/libs/integrations/src/sfas-integration/sfas-files/sfas-individual-record.ts b/sources/packages/backend/libs/integrations/src/sfas-integration/sfas-files/sfas-individual-record.ts index b9cedd58e1..e74d3e0fae 100644 --- a/sources/packages/backend/libs/integrations/src/sfas-integration/sfas-files/sfas-individual-record.ts +++ b/sources/packages/backend/libs/integrations/src/sfas-integration/sfas-files/sfas-individual-record.ts @@ -169,4 +169,16 @@ export class SFASIndividualRecord extends SFASRecordIdentification { get unsuccessfulCompletion(): number { return +this.line.substring(221, 231); } + /** + * The most recent Part-time Master Student Loan Agreement Number (agreement_num.sail_msfaa_numbers). + */ + get partTimeMSFAANumber(): number | null { + return +this.line.substring(231, 241) || null; + } + /** + * The most recent Part-time Master Student Loan Agreement effective date (effective_date.sail_msfaa_numbers). + */ + get partTimeMSFAAEffectiveDate(): Date | null { + return parseDate(this.line.substring(241, 249)); + } } diff --git a/sources/packages/backend/libs/sims-db/src/entities/sfas-individual.model.ts b/sources/packages/backend/libs/sims-db/src/entities/sfas-individual.model.ts index 70f56d572a..f072197d62 100644 --- a/sources/packages/backend/libs/sims-db/src/entities/sfas-individual.model.ts +++ b/sources/packages/backend/libs/sims-db/src/entities/sfas-individual.model.ts @@ -78,7 +78,7 @@ export class SFASIndividual extends BaseModel { name: "msfaa_number", nullable: true, }) - msfaaNumber?: number; + msfaaNumber?: string; /** * The most recent, active Master Student Loan Agreement signed date (loan_agreement_request.loan_agreement_signed_dte). */ @@ -194,4 +194,21 @@ export class SFASIndividual extends BaseModel { nullable: false, }) extractedAt: Date; + /** + * The most recent Part-time Master Student Loan Agreement Number (agreement_num.sail_msfaa_numbers). + */ + @Column({ + name: "part_time_msfaa_number", + nullable: true, + }) + partTimeMSFAANumber?: string; + /** + * The most recent Part-time Master Student Loan Agreement effective date (effective_date.sail_msfaa_numbers). + */ + @Column({ + name: "part_time_msfaa_effective_date", + type: "date", + nullable: true, + }) + partTimeMSFAAEffectiveDate?: string; }