diff --git a/src/api/services/portal/students/student-application-funding-requests-service.ts b/src/api/services/portal/students/student-application-funding-requests-service.ts index f55662dc..7cc869c7 100644 --- a/src/api/services/portal/students/student-application-funding-requests-service.ts +++ b/src/api/services/portal/students/student-application-funding-requests-service.ts @@ -31,13 +31,15 @@ export default class StudentApplicationFundingRequestsService { async getFundingRequests() { const fundingRequests = await db("fundingRequest") .where({ applicationId: this.#applicationId }) + .innerJoin("requestType", "requestType.id", "fundingRequest.requestTypeId") .leftJoin("status", "fundingRequest.statusId", "status.id") .leftJoin("statusReason", "fundingRequest.statusReasonId", "status.id") .select( "fundingRequest.*", "status.description as statusDescription", "statusReason.description as reasonDescription" - ); + ) + .orderByRaw("COALESCE(funding_group_id, 4), CASE WHEN request_type_id = 2 THEN 1 ELSE 2 END, request_type_id"); await this.#injectRequestTypes(fundingRequests); await this.#injectAssessments(fundingRequests); diff --git a/src/api/services/portal/students/student-applications-service.ts b/src/api/services/portal/students/student-applications-service.ts index 60196dec..64b98cd3 100644 --- a/src/api/services/portal/students/student-applications-service.ts +++ b/src/api/services/portal/students/student-applications-service.ts @@ -25,8 +25,20 @@ export default class StudentApplicationsService { getApplications() { return db("application") - .select("id", "studentId", "academicYearId", "updatedAt", "onlineSubmitDate") - .where({ studentId: this.#studentId }); + .innerJoin("institutionCampus", "institutionCampus.id", "application.institutionCampusId") + .innerJoin("institution", "institution.id", "institutionCampus.institutionId") + .select( + "application.id", + "studentId", + "academicYearId", + "updatedAt", + "onlineSubmitDate", + "institution.name AS institutionName", + "classesStartDate", + "classesEndDate" + ) + .where({ studentId: this.#studentId }) + .orderBy("academic_year_id", "desc"); } async getApplication() {