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

#1910 - Student profile returns SIN #2354

Merged
merged 7 commits into from
Sep 27, 2023

Conversation

andrepestana-aot
Copy link
Collaborator

@andrepestana-aot andrepestana-aot commented Sep 26, 2023

  • Added a new DTO to contain sensitive data and changed the logic to make the student api to not bring the SIN data.
  • Removed the SIN property from the student profile retrieved by the student.

Student view

image

Institution view

image

Ministry view

image

@andrepestana-aot andrepestana-aot self-assigned this Sep 26, 2023
@andrepestana-aot andrepestana-aot added Student Student Features SIMS-Api SIMS-Api labels Sep 26, 2023
@andrepestana-aot andrepestana-aot marked this pull request as ready for review September 26, 2023 20:27
@@ -181,10 +181,13 @@ export class StudentProfileAPIOutDTO {
contact: ContactInformationAPIOutDTO;
validSin: boolean;
disabilityStatus: DisabilityStatus;
}

export class SensitiveDataStudentProfileAPIOutDTO extends StudentProfileAPIOutDTO {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We probably have web dtos counterparts for these DTOs. Do they require any change also?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think we should change the web. In the web we are using the same DTO for all cases:
image
and in runtime JS doesn't complain about it:

image
Institution

image
Student

Copy link
Collaborator

@dheepak-aot dheepak-aot Sep 26, 2023

Choose a reason for hiding this comment

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

I see ministry student profile has SIN to it. But we can use a seperate service in Vue with different DTO for ministry and student.

Copy link
Contributor

@ann-aot ann-aot Sep 26, 2023

Choose a reason for hiding this comment

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

then shouldn't we make sin as optional in web?

Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot Sep 26, 2023

Choose a reason for hiding this comment

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

I believe that the below one can reflect both possible DTOs received from the API.

async getStudentProfile(
studentId?: number,
): Promise<StudentProfileAPIOutDTO> {
return this.getCall<StudentProfileAPIOutDTO>(
this.addClientRoot(`student/${studentId ?? ""}`),
);
}

The service is already returning a StudentProfile that can have optional properties like SIN, as @ann-aot mentioned.

async getStudentProfile(studentId?: number): Promise<StudentProfile> {
const { dateOnlyLongString } = useFormatters();
const studentProfile = await ApiClient.Students.getStudentProfile(
studentId,
);
const studentInfoAll: StudentProfile = {
...studentProfile,
birthDateFormatted: dateOnlyLongString(studentProfile.dateOfBirth),
};
return studentInfoAll;
}

The StudentProfile would be something like below.

export interface StudentProfile extends StudentProfileAPIOutDTO {
  birthDateFormatted: string;
  sin?: string;
  hasRestriction?: boolean;
}

Does it make sense?

Copy link
Collaborator

@guru-aot guru-aot left a comment

Choose a reason for hiding this comment

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

LGTM, nice work @andrepestana-aot

@@ -242,13 +242,18 @@ export class StudentAESTController extends BaseController {
@Param("studentId", ParseIntPipe) studentId: number,
): Promise<AESTStudentProfileAPIOutDTO> {
const [student, studentRestrictions] = await Promise.all([
this.studentControllerService.getStudentProfile(studentId),
this.studentControllerService.getStudentProfile(studentId, {
withSensitiveData: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@sh16011993 sh16011993 left a comment

Choose a reason for hiding this comment

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

Nice work. 👍

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 17.44% ( 2205 / 12643 )
Methods: 8.1% ( 129 / 1593 )
Lines: 20.18% ( 1932 / 9573 )
Branches: 9.75% ( 144 / 1477 )

@github-actions
Copy link

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 74.93% ( 514 / 686 )
Methods: 67.47% ( 56 / 83 )
Lines: 76.96% ( 451 / 586 )
Branches: 41.18% ( 7 / 17 )

@github-actions
Copy link

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 46.73% ( 300 / 642 )
Methods: 40% ( 32 / 80 )
Lines: 51.02% ( 251 / 492 )
Branches: 24.29% ( 17 / 70 )

@github-actions
Copy link

E2E SIMS API Coverage Report

Totals Coverage
Statements: 54.9% ( 4025 / 7331 )
Methods: 51.89% ( 493 / 950 )
Lines: 59.74% ( 3269 / 5472 )
Branches: 28.93% ( 263 / 909 )

Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot left a comment

Choose a reason for hiding this comment

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

Thanks for making the changes and for the discussions. Looks good 👍

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

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

Thanks @andrepestana-aot for doing the changes and for the info 👍

Copy link
Collaborator

@dheepak-aot dheepak-aot left a comment

Choose a reason for hiding this comment

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

Thanks for doing the changes 👍

@andrepestana-aot andrepestana-aot merged commit 6d79135 into main Sep 27, 2023
@andrepestana-aot andrepestana-aot deleted the 1910_api_student_profile_returns_sin branch September 27, 2023 21:19
@andrepestana-aot andrepestana-aot temporarily deployed to DEV September 27, 2023 21:33 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV September 27, 2023 21:35 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV September 27, 2023 21:35 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV September 27, 2023 21:35 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV September 27, 2023 21:35 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV September 27, 2023 21:37 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV September 27, 2023 21:37 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SIMS-Api SIMS-Api Student Student Features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants