Skip to content

Commit

Permalink
Merge branch 'main' into feature/#4253-Upgrade_Redis_version_and_incr…
Browse files Browse the repository at this point in the history
…ease_Memory
  • Loading branch information
guru-aot committed Jan 25, 2025
2 parents a386de3 + 39048ae commit 8618b98
Show file tree
Hide file tree
Showing 48 changed files with 9,215 additions and 8,737 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release-deploy-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ env:
MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER: ${{ vars.MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER }}
MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION: ${{ vars.MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION }}
MAXIMUM_IDLE_TIME_FOR_WARNING_AEST: ${{ vars.MAXIMUM_IDLE_TIME_FOR_WARNING_AEST }}
APP_ENV: ${{ vars.APP_ENV }}
TLS_CERTIFICATE: ${{ secrets.TLS_CERTIFICATE }}
TLS_KEY: ${{ secrets.TLS_KEY }}
TLS_CA_CERTIFICATE: ${{ secrets.TLS_CA_CERTIFICATE }}
Expand Down
3 changes: 3 additions & 0 deletions configs/env-example
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,6 @@ MAXIMUM_IDLE_TIME_FOR_WARNING_AEST =

# Allow beta users only to access the system if true.
ALLOW_BETA_USERS_ONLY=

# App Environment
APP_ENV=
1 change: 1 addition & 0 deletions devops/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ deploy-api:
-p MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER=$(MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER) \
-p MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION=$(MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION) \
-p MAXIMUM_IDLE_TIME_FOR_WARNING_AEST=$(MAXIMUM_IDLE_TIME_FOR_WARNING_AEST) \
-p APP_ENV=$(APP_ENV) \
-p TLS_CERTIFICATE=$(TLS_CERTIFICATE) \
-p TLS_KEY=$(TLS_KEY) \
-p TLS_CA_CERTIFICATE=$(TLS_CA_CERTIFICATE) \
Expand Down
4 changes: 4 additions & 0 deletions devops/openshift/api-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ objects:
value: "${MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION}"
- name: MAXIMUM_IDLE_TIME_FOR_WARNING_AEST
value: "${MAXIMUM_IDLE_TIME_FOR_WARNING_AEST}"
- name: APP_ENV
value: "${APP_ENV}"
- name: ALLOW_BETA_USERS_ONLY
value: "${ALLOW_BETA_USERS_ONLY}"
- name: POSTGRES_HOST
Expand Down Expand Up @@ -527,6 +529,8 @@ parameters:
required: true
- name: MAXIMUM_IDLE_TIME_FOR_WARNING_AEST
required: true
- name: APP_ENV
required: true
- name: TLS_CERTIFICATE
required: true
- name: TLS_KEY
Expand Down
3 changes: 3 additions & 0 deletions sources/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER := $(or $(MAXIMUM_IDLE_TIM
export MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION := $(or $(MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION), 3600)
export MAXIMUM_IDLE_TIME_FOR_WARNING_AEST := $(or $(MAXIMUM_IDLE_TIME_FOR_WARNING_AEST), 3600)

# App Environment
export APP_ENV := $(or $(APP_ENV), local)

# Allow beta users only to access the system if true.
export ALLOW_BETA_USERS_ONLY := $(or $(ALLOW_BETA_USERS_ONLY), false)

Expand Down
1 change: 1 addition & 0 deletions sources/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ services:
- MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER=${MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER}
- MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION=${MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION}
- MAXIMUM_IDLE_TIME_FOR_WARNING_AEST=${MAXIMUM_IDLE_TIME_FOR_WARNING_AEST}
- APP_ENV=${APP_ENV}
- ALLOW_BETA_USERS_ONLY=${ALLOW_BETA_USERS_ONLY}
ports:
- ${API_PORT}:${API_PORT}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
getAESTToken,
} from "../../../../testHelpers";
import { ApplicationExceptionStatus, ApplicationStatus } from "@sims/sims-db";
import { getUserFullName } from "../../../../utilities";
import { saveFakeApplicationWithApplicationException } from "../application-exception-helper";
import { createE2EDataSources, E2EDataSources } from "@sims/test-utils";

Expand Down Expand Up @@ -84,15 +83,17 @@ describe("ApplicationExceptionAESTController(e2e)-getPendingApplicationException
applicationNumber: application1.applicationNumber,
submittedDate:
application1.applicationException.createdAt.toISOString(),
fullName: getUserFullName(application1.student.user),
givenNames: application1.student.user.firstName,
lastName: application1.student.user.lastName,
}),
expect.objectContaining({
applicationId: application2.id,
studentId: application2.student.id,
applicationNumber: application2.applicationNumber,
submittedDate:
application2.applicationException.createdAt.toISOString(),
fullName: getUserFullName(application2.student.user),
givenNames: application2.student.user.firstName,
lastName: application2.student.user.lastName,
}),
]),
);
Expand All @@ -103,7 +104,8 @@ describe("ApplicationExceptionAESTController(e2e)-getPendingApplicationException
applicationNumber: application3.applicationNumber,
submittedDate:
application3.applicationException.createdAt.toISOString(),
fullName: getUserFullName(application3.student.user),
givenNames: application3.student.user.firstName,
lastName: application3.student.user.lastName,
}),
);
expect(applicationExceptionList).not.toContainEqual(
Expand All @@ -113,7 +115,8 @@ describe("ApplicationExceptionAESTController(e2e)-getPendingApplicationException
applicationNumber: application4.applicationNumber,
submittedDate:
application4.applicationException.createdAt.toISOString(),
fullName: getUserFullName(application4.student.user),
givenNames: application4.student.user.firstName,
lastName: application4.student.user.lastName,
}),
);
expect(applicationExceptionList).not.toContainEqual(
Expand All @@ -123,7 +126,8 @@ describe("ApplicationExceptionAESTController(e2e)-getPendingApplicationException
applicationNumber: application5.applicationNumber,
submittedDate:
application5.applicationException.createdAt.toISOString(),
fullName: getUserFullName(application5.student.user),
givenNames: application5.student.user.firstName,
lastName: application5.student.user.lastName,
}),
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
UpdateApplicationExceptionAPIInDTO,
} from "./models/application-exception.dto";
import { IUserToken } from "../../auth/userToken.interface";
import { getUserFullName } from "../../utilities";
import { CustomNamedError } from "@sims/utilities";
import {
STUDENT_APPLICATION_EXCEPTION_INVALID_STATE,
Expand Down Expand Up @@ -141,7 +140,8 @@ export class ApplicationExceptionAESTController extends BaseController {
studentId: eachApplication.application.student.id,
applicationNumber: eachApplication.application.applicationNumber,
submittedDate: eachApplication.createdAt,
fullName: getUserFullName(eachApplication.application.student.user),
givenNames: eachApplication.application.student.user.firstName,
lastName: eachApplication.application.student.user.lastName,
})),
count: applicationExceptions.count,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class ApplicationExceptionSummaryAPIOutDTO {
applicationId: number;
studentId: number;
submittedDate: Date;
fullName: string;
givenNames?: string;
lastName: string;
applicationNumber: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe("ConfigController(e2e)-getConfig", () => {
MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER: "270",
MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION: "3600",
MAXIMUM_IDLE_TIME_FOR_WARNING_AEST: "3600",
APP_ENV: "production",
};

beforeAll(async () => {
Expand Down Expand Up @@ -65,6 +66,7 @@ describe("ConfigController(e2e)-getConfig", () => {
+fakeEnvVariables.MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION,
maximumIdleTimeForWarningAEST:
+fakeEnvVariables.MAXIMUM_IDLE_TIME_FOR_WARNING_AEST,
appEnv: fakeEnvVariables.APP_ENV,
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class ConfigController extends BaseController {
this.configService.maximumIdleTimeForWarningInstitution,
maximumIdleTimeForWarningAEST:
this.configService.maximumIdleTimeForWarningAEST,
appEnv: this.configService.appEnv,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export class ConfigAPIOutDTO {
maximumIdleTimeForWarningSupportingUser: number;
maximumIdleTimeForWarningInstitution: number;
maximumIdleTimeForWarningAEST: number;
appEnv: string;
}

export class AuthConfigAPIOutDTO {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class ApplicationStatusPaginationOptionsAPIInDTO extends PaginationOption

export class ApplicationExceptionPaginationOptionsAPIInDTO extends PaginationOptionsAPIInDTO {
@IsOptional()
@IsIn(["submittedDate", "applicationNumber", "fullName"])
@IsIn(["submittedDate", "applicationNumber", "givenNames", "lastName"])
sortField?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export class CreateStudentAccountApplicationAPIInDTO {

export class StudentAccountApplicationSummaryAPIOutDTO {
id: number;
fullName: string;
lastName: string;
givenNames: string;
dateOfBirth: string;
submittedDate: Date;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import {
StudentAccountApplicationApprovalAPIInDTO,
StudentAccountApplicationSummaryAPIOutDTO,
} from "./models/student-account-application.dto";
import { getUserFullName } from "../../utilities";
import { CustomNamedError } from "@sims/utilities";
import { IUserToken } from "../../auth/userToken.interface";
import {
Expand Down Expand Up @@ -79,7 +78,9 @@ export class StudentAccountApplicationAESTController extends BaseController {
await this.studentAccountApplicationsService.getPendingStudentAccountApplications();
return accountApplications.map((accountApplication) => ({
id: accountApplication.id,
fullName: getUserFullName(accountApplication.user),
lastName: accountApplication.user.lastName,
givenNames: accountApplication.user.firstName,
dateOfBirth: accountApplication.submittedData.dateOfBirth,
submittedDate: accountApplication.submittedDate,
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,12 @@ export class ApplicationExceptionService extends RecordDataModelService<Applicat
sortOrder = FieldSortOrder.ASC,
): OrderByCondition {
const orderByCondition = {};
if (sortField === "fullName") {
orderByCondition["user.firstName"] = sortOrder;
orderByCondition["user.lastName"] = sortOrder;
return orderByCondition;
}

const fieldSortOptions = {
applicationNumber: "application.applicationNumber",
submittedDate: "exception.createdAt",
givenNames: "user.firstName",
lastName: "user.lastName",
};

const dbColumnName = fieldSortOptions[sortField];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { User } from "@sims/sims-db";
import { StudentInfo } from "../student/student.service.models";

/**
Expand Down Expand Up @@ -33,3 +34,14 @@ export type StudentAccountApplicationApprovalModel = StudentInfo &
export interface AccountApplicationSubmittedData {
sinConsent: boolean;
}

/**
* Data needed to obtain a list of student account applications
* waiting to be assessed by the Ministry.
*/
export interface StudentAccountApplicationSummary {
id: number;
user: User;
submittedData: { dateOfBirth?: string };
submittedDate: Date;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
AccountApplicationSubmittedData,
StudentAccountApplicationApprovalModel,
StudentAccountApplicationCreateModel,
StudentAccountApplicationSummary,
} from "./student-account-applications.models";
import { StudentService } from "../student/student.service";
import { CustomNamedError } from "@sims/utilities";
Expand Down Expand Up @@ -49,12 +50,13 @@ export class StudentAccountApplicationsService extends RecordDataModelService<St
* @returns list of pending student account applications.
*/
async getPendingStudentAccountApplications(): Promise<
StudentAccountApplication[]
StudentAccountApplicationSummary[]
> {
return this.repo.find({
select: {
id: true,
submittedDate: true,
submittedData: true as unknown,
user: { firstName: true, lastName: true },
},
relations: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ export class StudentAssessmentService extends RecordDataModelService<StudentAsse
});
}
return assessmentHistoryQuery
.orderBy("assessment.studentAssessmentStatus", "DESC")
.addOrderBy("assessment.submittedDate", "DESC")
.orderBy("assessment.submittedDate", "DESC")
.getMany();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ export class ConfigService {
);
}

/**
* App environment.
* @returns app environment.
*/
get appEnv(): string {
return this.getCachedConfig("appEnvConfig", process.env.APP_ENV);
}

/**
* Maximum idle time for warning student Configuration.
* @returns maximum idle time for warning student number.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:biodi="http://bpmn.io/schema/dmn/biodi/2.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" xmlns:camunda="http://camunda.org/schema/1.0/dmn" id="dmnPartTimeAssessmentDecisions" name="dmnPartTimeAssessmentDecisions" namespace="http://camunda.org/schema/1.0/dmn" exporter="Camunda Modeler" exporterVersion="5.29.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.1.0" camunda:diagramRelationId="1a575ead-1e6d-468c-901a-766a35569b38">
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:biodi="http://bpmn.io/schema/dmn/biodi/2.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" xmlns:camunda="http://camunda.org/schema/1.0/dmn" id="dmnPartTimeAssessmentDecisions" name="dmnPartTimeAssessmentDecisions" namespace="http://camunda.org/schema/1.0/dmn" exporter="Camunda Modeler" exporterVersion="5.31.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.6.0" camunda:diagramRelationId="1a575ead-1e6d-468c-901a-766a35569b38">
<decision id="dmnPartTimeProgramYearMaximums" name="dmnPartTimeProgramYearMaximums">
<decisionTable id="DecisionTable_1oyvbif" hitPolicy="FIRST">
<input id="InputClause_02zjhj9" label="programYear">
Expand Down Expand Up @@ -617,7 +617,7 @@
<text>"2022-2023"</text>
</inputEntry>
<inputEntry id="UnaryTests_0cb65f7">
<text>&gt; 7</text>
<text>&gt;= 7</text>
</inputEntry>
<outputEntry id="LiteralExpression_19tnso3">
<text>84933</text>
Expand Down Expand Up @@ -946,7 +946,7 @@
<text>"2023-2024"</text>
</inputEntry>
<inputEntry id="UnaryTests_1q5nz0l">
<text>&gt; 7</text>
<text>&gt;= 7</text>
</inputEntry>
<outputEntry id="LiteralExpression_1mhcmbi">
<text>93737</text>
Expand Down Expand Up @@ -1282,7 +1282,7 @@
<text>"2024-2025"</text>
</inputEntry>
<inputEntry id="UnaryTests_133s2og">
<text>&gt; 7</text>
<text>&gt;= 7</text>
</inputEntry>
<outputEntry id="LiteralExpression_0lnlz1h">
<text>97395</text>
Expand Down Expand Up @@ -1611,7 +1611,7 @@
<text>"2025-2026"</text>
</inputEntry>
<inputEntry id="UnaryTests_1x0upra">
<text>&gt; 7</text>
<text>&gt;= 7</text>
</inputEntry>
<outputEntry id="LiteralExpression_0p7ohoj">
<text>97395</text>
Expand Down
Loading

0 comments on commit 8618b98

Please sign in to comment.