Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3896 - Mask Institution User Income View #3932

Merged
merged 4 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ describe("AssessmentInstitutionsController(e2e)-getAssessmentNOA", () => {
applicationId: application.id,
applicationNumber: application.applicationNumber,
applicationStatus: application.applicationStatus,
assessment: assessment.assessmentData,
assessment: {
...assessment.assessmentData,
totalFamilyIncome: "XXXXX",
},
disbursement: {
disbursement1COEStatus: firstDisbursementSchedule.coeStatus,
disbursement1Date: getDateOnlyFullMonthFormat(
Expand Down Expand Up @@ -210,7 +213,10 @@ describe("AssessmentInstitutionsController(e2e)-getAssessmentNOA", () => {
applicationId: application.id,
applicationNumber: application.applicationNumber,
applicationStatus: application.applicationStatus,
assessment: assessment.assessmentData,
assessment: {
...assessment.assessmentData,
totalFamilyIncome: "XXXXX",
},
disbursement: {
disbursement1COEStatus: firstDisbursementSchedule.coeStatus,
disbursement1Date: getDateOnlyFullMonthFormat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export class AssessmentAESTController extends BaseController {
): Promise<AssessmentNOAAPIOutDTO> {
return this.assessmentControllerService.getAssessmentNOA(assessmentId, {
maskMSFAA: false,
maskTotalFamilyIncome: false,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
ApplicationExceptionService,
MASKED_MSFAA_NUMBER,
ApplicationOfferingChangeRequestService,
MASKED_MONEY_AMOUNT,
} from "../../services";
import {
AssessmentNOAAPIOutDTO,
Expand All @@ -34,6 +35,7 @@ import {
RequestAssessmentTypeAPIOutDTO,
AssessmentHistorySummaryAPIOutDTO,
DynamicAwardValue,
AssessmentAPIOutDTO,
} from "./models/assessment.dto";
import { getUserFullName } from "../../utilities";
import { getDateOnlyFormat, getDateOnlyFullMonthFormat } from "@sims/utilities";
Expand Down Expand Up @@ -63,6 +65,8 @@ export class AssessmentControllerService {
* - `studentId` optional student for authorization when needed.
* - `applicationId` application id,
* - `maskMSFAA` mask MSFAA or not.
* - `maskTotalFamilyIncome` mask total family income resulted
* from the assessment calculations. Defaults to true if not provided.
* @returns notice of assessment data.
*/
async getAssessmentNOA(
Expand All @@ -71,8 +75,10 @@ export class AssessmentControllerService {
studentId?: number;
applicationId?: number;
maskMSFAA?: boolean;
maskTotalFamilyIncome?: boolean;
},
): Promise<AssessmentNOAAPIOutDTO> {
const maskTotalFamilyIncome = options?.maskTotalFamilyIncome ?? true;
const assessment = await this.assessmentService.getAssessmentForNOA(
assessmentId,
{ studentId: options?.studentId, applicationId: options?.applicationId },
Expand All @@ -88,8 +94,13 @@ export class AssessmentControllerService {
);
}

const assessmentDTO: AssessmentAPIOutDTO = assessment.assessmentData;
if (maskTotalFamilyIncome) {
assessmentDTO.totalFamilyIncome = MASKED_MONEY_AMOUNT;
}

return {
assessment: assessment.assessmentData,
assessment: assessmentDTO,
applicationId: assessment.application.id,
noaApprovalStatus: assessment.noaApprovalStatus,
applicationStatus: assessment.application.applicationStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class AssessmentStudentsController extends BaseController {
return this.assessmentControllerService.getAssessmentNOA(assessmentId, {
studentId: userToken.studentId,
maskMSFAA: false,
maskTotalFamilyIncome: false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,28 @@ export class AssessmentHistorySummaryAPIOutDTO {
hasUnsuccessfulWeeks?: boolean;
}

/**
* Assessment calculations output with possible
* adjustments for API output DTO.
*/
export type AssessmentAPIOutDTO = Omit<Assessment, "totalFamilyIncome"> & {
/**
* Total family income to be considered.
* Users without proper access should see only a masked value.
* This property overrides the original type to allow to keep
* the property as number and also as a string, when a mask is required.
*/
totalFamilyIncome: number | string;
};

export class AssessmentNOAAPIOutDTO {
@ApiProperty({
description:
"Dynamic output of the workflow calculation. " +
"Contains data that could represent a part-time or a full-time assessment. " +
"Part-time and full-time will have some common and some specific properties for each payload.",
})
assessment: Assessment;
assessment: AssessmentAPIOutDTO;
applicationId: number;
applicationNumber: string;
applicationCurrentAssessmentId: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export const ASSESSMENT_NOT_FOUND = "ASSESSMENT_NOT_FOUND";
export const ASSESSMENT_INVALID_OPERATION_IN_THE_CURRENT_STATE =
"ASSESSMENT_INVALID_OPERATION_IN_THE_CURRENT_STATE";
export const MASKED_MSFAA_NUMBER = "XXXXXXXXXX";
export const MASKED_MONEY_AMOUNT = "XXXXX";