Skip to content

Commit

Permalink
adds new fields to graphql query
Browse files Browse the repository at this point in the history
  • Loading branch information
aanxniee committed Dec 6, 2023
1 parent 724056e commit fbe8bce
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 22 deletions.
11 changes: 8 additions & 3 deletions backend/typescript/graphql/resolvers/dashboardResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ const dashboardResolvers = {
_parent: undefined,
{ secondChoice }: { secondChoice: ApplicantRole },
): Promise<Array<ApplicationDTO>> => {
const applications = await dashboardService.getApplicationsBySecondChoiceRole(
secondChoice,
);
const applications =

Check failure on line 42 in backend/typescript/graphql/resolvers/dashboardResolvers.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `⏎········await·dashboardService.getApplicationsBySecondChoiceRole(secondChoice` with `·await·dashboardService.getApplicationsBySecondChoiceRole(⏎········secondChoice,⏎······`
await dashboardService.getApplicationsBySecondChoiceRole(secondChoice);
return applications;
},
dashboardsByApplicationId: async (
Expand Down Expand Up @@ -79,8 +78,10 @@ const dashboardResolvers = {
teamPlayer,
desireToLearn,
skill,
totalScore,
skillCategory,
reviwerComments,
adminComments,
recommendedSecondChoice,
}: {
reviewerEmail: string;
Expand All @@ -90,8 +91,10 @@ const dashboardResolvers = {
teamPlayer: number;
desireToLearn: number;
skill: number;
totalScore: number;
skillCategory: string;
reviwerComments: string;
adminComments: string;
recommendedSecondChoice: string;
},
): Promise<ApplicationDashboardDTO> => {
Expand All @@ -103,8 +106,10 @@ const dashboardResolvers = {
teamPlayer,
desireToLearn,
skill,
totalScore,
skillCategory,
reviwerComments,
adminComments,
recommendedSecondChoice,
);
},
Expand Down
2 changes: 2 additions & 0 deletions backend/typescript/graphql/types/dashboardType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ const dashboardType = gql`
teamPlayer: Int!
desireToLearn: Int!
skill: Int!
totalScore: Int!
skillCategory: String!
reviwerComments: String!
adminComments: String!
recommendedSecondChoice: String!
): ApplicationDashboardDTO!
}
Expand Down
43 changes: 27 additions & 16 deletions backend/typescript/services/implementations/appDashboardService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ class AppDashboardService implements IAppDashboardService {
teamPlayer: dashboard.teamPlayer,
desireToLearn: dashboard.desireToLearn,
skill: dashboard.skill,
totalScore: dashboard.totalScore,
skillCategory: dashboard.skillCategory,
reviewerComments: dashboard.reviewerComments,
adminComments: dashboard.adminComments,
recommendedSecondChoice: dashboard.recommendedSecondChoice,
reviewerId: dashboard.reviewerId,
applicationId: dashboard.applicationId,
Expand Down Expand Up @@ -166,8 +168,8 @@ class AppDashboardService implements IAppDashboardService {
);
},
);
applicationsBySecondChoiceRoleDTO = await applicationsBySecondChoiceRole.map(
(application) => {
applicationsBySecondChoiceRoleDTO =

Check failure on line 171 in backend/typescript/services/implementations/appDashboardService.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `⏎········await·applicationsBySecondChoiceRole.map(` with `·await·applicationsBySecondChoiceRole.map(⏎········`
await applicationsBySecondChoiceRole.map((application) => {
return {
id: application.id,
academicOrCoop: application.academicOrCoop,
Expand All @@ -191,8 +193,7 @@ class AppDashboardService implements IAppDashboardService {
timesApplied: application.timesApplied,
timestamp: application.timestamp,
};
},
);
});

Check failure on line 196 in backend/typescript/services/implementations/appDashboardService.ts

View workflow job for this annotation

GitHub Actions / run-lint

Insert `,⏎······`
} catch (error: unknown) {
Logger.error(
`Failed to get applications by this second choice role = ${role}. Reason = ${getErrorMessage(
Expand Down Expand Up @@ -221,8 +222,10 @@ class AppDashboardService implements IAppDashboardService {
teamPlayer: dashboard.teamPlayer,
desireToLearn: dashboard.desireToLearn,
skill: dashboard.skill,
totalScore: dashboard.totalScore,
skillCategory: dashboard.skillCategory,
reviewerComments: dashboard.reviewerComments,
adminComments: dashboard.adminComments,
recommendedSecondChoice: dashboard.recommendedSecondChoice,
reviewerId: dashboard.reviewerId,
applicationId: dashboard.applicationId,
Expand All @@ -243,15 +246,13 @@ class AppDashboardService implements IAppDashboardService {
role: ApplicantRole,
): Promise<ApplicationDashboardRowDTO[]> {
// get all the applications for the role
const applications: Array<ApplicationDTO> = await this.getApplicationsByRole(
role,
);
const applications: Array<ApplicationDTO> =

Check failure on line 249 in backend/typescript/services/implementations/appDashboardService.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `⏎······await·this.getApplicationsByRole(role` with `·await·this.getApplicationsByRole(⏎······role,⏎····`
await this.getApplicationsByRole(role);
// get the dashboards associated with the applications
const appDashRows: Array<ApplicationDashboardRowDTO> = await Promise.all(
applications.map(async (application) => {
const reviewDashboards: Array<ApplicationDashboardDTO> = await this.getDashboardsByApplicationId(
application.id,
);
const reviewDashboards: Array<ApplicationDashboardDTO> =

Check failure on line 254 in backend/typescript/services/implementations/appDashboardService.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `⏎··········await·this.getDashboardsByApplicationId(application.id` with `·await·this.getDashboardsByApplicationId(⏎··········application.id,⏎········`
await this.getDashboardsByApplicationId(application.id);
const reviewers: Array<UserDTO> = await Promise.all(
reviewDashboards.map(async (dash) => {
return userService.getUserByEmail(dash.reviewerEmail);
Expand All @@ -271,15 +272,13 @@ class AppDashboardService implements IAppDashboardService {
role: ApplicantRole,
): Promise<ApplicationDashboardRowDTO[]> {
// get all the applications for the role
const applications: Array<ApplicationDTO> = await this.getApplicationsBySecondChoiceRole(
role,
);
const applications: Array<ApplicationDTO> =

Check failure on line 275 in backend/typescript/services/implementations/appDashboardService.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `⏎······await·this.getApplicationsBySecondChoiceRole(role` with `·await·this.getApplicationsBySecondChoiceRole(⏎······role,⏎····`
await this.getApplicationsBySecondChoiceRole(role);
// get the dashboards associated with the applications
const appDashRows: Array<ApplicationDashboardRowDTO> = await Promise.all(
applications.map(async (application) => {
const reviewDashboards: Array<ApplicationDashboardDTO> = await this.getDashboardsByApplicationId(
application.id,
);
const reviewDashboards: Array<ApplicationDashboardDTO> =

Check failure on line 280 in backend/typescript/services/implementations/appDashboardService.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `⏎··········await·this.getDashboardsByApplicationId(application.id` with `·await·this.getDashboardsByApplicationId(⏎··········application.id,⏎········`
await this.getDashboardsByApplicationId(application.id);
const reviewers: Array<UserDTO> = await Promise.all(
reviewDashboards.map(async (dash) => {
return userService.getUserByEmail(dash.reviewerEmail);
Expand Down Expand Up @@ -331,8 +330,10 @@ class AppDashboardService implements IAppDashboardService {
teamPlayer: dashboard.teamPlayer,
desireToLearn: dashboard.desireToLearn,
skill: dashboard.skill,
totalScore: dashboard.totalScore,
skillCategory: dashboard.skillCategory,
reviewerComments: dashboard.reviewerComments,
adminComments: dashboard.adminComments,
recommendedSecondChoice: dashboard.recommendedSecondChoice,
reviewerId: dashboard.reviewerId,
applicationId: dashboard.applicationId,
Expand All @@ -347,8 +348,10 @@ class AppDashboardService implements IAppDashboardService {
teamPlayer: number,
desireToLearn: number,
skill: number,
totalScore: number,
skillCategory: string,
reviewerComments: string,
adminComments: string,
recommendedSecondChoice: string,
): Promise<ApplicationDashboardDTO> {
try {
Expand All @@ -363,8 +366,10 @@ class AppDashboardService implements IAppDashboardService {
teamPlayer,
desireToLearn,
skill,
totalScore,
skillCategory,
reviewerComments,
adminComments,
recommendedSecondChoice,
});
Logger.error(`the data: ${JSON.stringify(dashboard)}`);
Expand All @@ -375,8 +380,10 @@ class AppDashboardService implements IAppDashboardService {
teamPlayer: dashboard.teamPlayer,
desireToLearn: dashboard.desireToLearn,
skill: dashboard.skill,
totalScore: dashboard.totalScore,
skillCategory: dashboard.skillCategory,
reviewerComments: dashboard.reviewerComments,
adminComments: dashboard.adminComments,
recommendedSecondChoice: dashboard.recommendedSecondChoice,
reviewerId: dashboard.reviewerId,
applicationId: dashboard.applicationId,
Expand Down Expand Up @@ -413,8 +420,10 @@ class AppDashboardService implements IAppDashboardService {
teamPlayer: dashboard.teamPlayer,
desireToLearn: dashboard.desireToLearn,
skill: dashboard.skill,
totalScore: dashboard.totalScore,
skillCategory: dashboard.skillCategory,
reviewerComments: dashboard.reviewerComments,
adminComments: dashboard.adminComments,
recommendedSecondChoice: dashboard.recommendedSecondChoice,
reviewerId: dashboard.reviewerId,
applicationId: dashboard.applicationId,
Expand Down Expand Up @@ -447,8 +456,10 @@ class AppDashboardService implements IAppDashboardService {
teamPlayer: dashboard.teamPlayer,
desireToLearn: dashboard.desireToLearn,
skill: dashboard.skill,
totalScore: dashboard.totalScore,
skillCategory: dashboard.skillCategory,
reviewerComments: dashboard.reviewerComments,
adminComments: dashboard.adminComments,
recommendedSecondChoice: dashboard.recommendedSecondChoice,
reviewerId: dashboard.reviewerId,
applicationId: dashboard.applicationId,
Expand Down
11 changes: 8 additions & 3 deletions backend/typescript/services/interfaces/appDashboardService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ interface IAppDashboardService {
* @Param reviewerEmail the email of the reviewer
* @param applicationId the id of the application (seperate from the postgres id field of the application)
* @param reviewerAuthId the Firebase auth id of the user (This is NOT the same as the postgress id field of the user)
* @param passionFSG passion for social good rating of applicatn
* @param teamPlayer teamwork rating of applicatn
* @param skill skill rating of applicatn
* @param passionFSG passion for social good rating of application
* @param teamPlayer teamwork rating of application
* @param desireToLearn willingness to learn rating of application
* @param skill skill rating of application
* @param totalScore sum of passionFSG, teamPlayer, desireToLearn, and skill
* @param skillCategory whether applicant is viewed as junior, intermediate, or senior
* @param reviewerComments comments of the application from reviewer
* @param adminComments comments of the application from admin
* @param recommendedSecondChoice an indication of whether 2nd choice is recommended
* @param reviewComplete whether the reviewer has finished the review
* @returns an array of the updated dashboard entry ids
Expand All @@ -54,8 +57,10 @@ interface IAppDashboardService {
teamPlayer: number,
desireToLearn: number,
skill: number,
totalScore: number,
skillCategory: string,
reviewerComments: string,
adminComments: string,
recommendedSecondChoice: string,
): Promise<ApplicationDashboardDTO>;

Expand Down
2 changes: 2 additions & 0 deletions backend/typescript/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ export type ApplicationDashboardDTO = {
teamPlayer: number;
desireToLearn: number;
skill: number;
totalScore: number;
skillCategory: string;
reviewerComments: string;
adminComments: string;
recommendedSecondChoice: string;
reviewerId: number;
applicationId: number;
Expand Down

0 comments on commit fbe8bce

Please sign in to comment.