-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Created report Disbursements Without Valid Supplier: ![image](https://github.com/user-attachments/assets/9c7ee806-3deb-468c-b240-cf5b9e3ede28) - Created E2E test. Migration revert: ![image](https://github.com/user-attachments/assets/4cf40a92-eddd-4410-bdac-92574234add0)
- Loading branch information
1 parent
4f25ed6
commit c2e0a5f
Showing
10 changed files
with
331 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...-migrations/src/migrations/1732567769085-CreateDisbursementsWithoutValidSupplierReport.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import { getSQLFileData } from "../utilities/sqlLoader"; | ||
|
||
export class CreateDisbursementsWithoutValidSupplierReport1732567769085 | ||
implements MigrationInterface | ||
{ | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
getSQLFileData( | ||
"Create-disbursements-without-valid-supplier-report.sql", | ||
"Reports", | ||
), | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
getSQLFileData( | ||
"Rollback-create-disbursements-without-valid-supplier-report.sql", | ||
"Reports", | ||
), | ||
); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...apps/db-migrations/src/sql/Reports/Create-disbursements-without-valid-supplier-report.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
INSERT INTO | ||
sims.report_configs (report_name, report_sql) | ||
VALUES | ||
( | ||
'Disbursements_Without_Valid_Supplier_Report', | ||
'SELECT | ||
users.first_name AS "Given Name", | ||
users.last_name AS "Last Name", | ||
sin_validations.sin AS "SIN", | ||
users.identity_provider_type AS "Profile Type", | ||
students.contact_info -> ''address'' ->> ''addressLine1'' AS "Address Line 1", | ||
students.contact_info -> ''address'' ->> ''city'' AS "City", | ||
students.contact_info -> ''address'' ->> ''provinceState'' AS "Province", | ||
students.contact_info -> ''address'' ->> ''country'' AS "Country", | ||
students.contact_info -> ''address'' ->> ''postalCode'' AS "Postal Code", | ||
students.disability_status AS "Disability Status", | ||
SUM( | ||
CASE | ||
WHEN disbursement_values.value_code = ''BCAG'' THEN disbursement_values.effective_amount | ||
ELSE 0 | ||
END | ||
) AS "BCAG", | ||
SUM( | ||
CASE | ||
WHEN disbursement_values.value_code = ''SBSD'' THEN disbursement_values.effective_amount | ||
ELSE 0 | ||
END | ||
) AS "SBSD", | ||
SUM( | ||
CASE | ||
WHEN disbursement_values.value_code = ''BGPD'' THEN disbursement_values.effective_amount | ||
ELSE 0 | ||
END | ||
) AS "BGPD" | ||
FROM | ||
sims.students students | ||
INNER JOIN sims.users users ON students.user_id = users.id | ||
INNER JOIN sims.sin_validations sin_validations ON students.id = sin_validations.student_id | ||
INNER JOIN sims.cas_suppliers cas_suppliers ON cas_suppliers.student_id = students.id | ||
INNER JOIN sims.applications applications ON applications.student_id = students.id | ||
INNER JOIN sims.student_assessments student_assessments ON student_assessments.application_id = applications.id | ||
INNER JOIN sims.disbursement_schedules disbursement_schedules ON disbursement_schedules.student_assessment_id = student_assessments.id | ||
INNER JOIN sims.disbursement_values disbursement_values ON disbursement_values.disbursement_schedule_id = disbursement_schedules.id | ||
WHERE | ||
disbursement_schedules.disbursement_schedule_status = ''Sent'' | ||
AND disbursement_schedules.date_sent BETWEEN :startDate | ||
AND :endDate | ||
AND cas_suppliers.is_valid = false | ||
GROUP BY | ||
users.id, | ||
sin_validations.sin, | ||
students.contact_info, | ||
students.disability_status;' | ||
); |
4 changes: 4 additions & 0 deletions
4
...igrations/src/sql/Reports/Rollback-create-disbursements-without-valid-supplier-report.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DELETE FROM | ||
sims.report_configs | ||
WHERE | ||
report_name = 'Disbursements_Without_Valid_Supplier_Report'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.