diff --git a/backend/typescript/graphql/resolvers/dashboardResolvers.ts b/backend/typescript/graphql/resolvers/dashboardResolvers.ts index 533c327..388a8db 100644 --- a/backend/typescript/graphql/resolvers/dashboardResolvers.ts +++ b/backend/typescript/graphql/resolvers/dashboardResolvers.ts @@ -5,6 +5,7 @@ import { ApplicationDTO, ApplicationDashboardInput, ApplicationDashboardRowDTO, + ApplicantRole } from "../../types"; const dashboardService: IAppDashboardService = new AppDashboardService(); @@ -20,7 +21,7 @@ const dashboardResolvers = { }, applicationsByRole: async ( _parent: undefined, - { firstChoice }: { firstChoice: string }, + { firstChoice }: { firstChoice: ApplicantRole }, ): Promise<Array<ApplicationDTO>> => { const applications = await dashboardService.getApplicationsByRole( firstChoice, @@ -29,7 +30,7 @@ const dashboardResolvers = { }, applicationsBySecondChoiceRole: async ( _parent: undefined, - { secondChoice }: { secondChoice: string }, + { secondChoice }: { secondChoice: ApplicantRole }, ): Promise<Array<ApplicationDTO>> => { const applications = await dashboardService.getApplicationsBySecondChoiceRole( secondChoice, @@ -47,13 +48,13 @@ const dashboardResolvers = { }, applicationTable: async ( _parent: undefined, - { role }: { role: string }, + { role }: { role: ApplicantRole }, ): Promise<ApplicationDashboardRowDTO[]> => { return dashboardService.getApplicationDashboardTable(role); }, secondChoiceRoleApplicationTable: async ( _parent: undefined, - { role }: { role: string }, + { role }: { role: ApplicantRole }, ): Promise<ApplicationDashboardRowDTO[]> => { return dashboardService.getApplicationBySecondChoiceRoleDashboardTable(role); }, diff --git a/backend/typescript/models/application.model.ts b/backend/typescript/models/application.model.ts index 6d2e446..0520530 100644 --- a/backend/typescript/models/application.model.ts +++ b/backend/typescript/models/application.model.ts @@ -3,7 +3,7 @@ import { Column, DataType, HasMany, Model, Table } from "sequelize-typescript"; import ApplicationDashboardTable from "./applicationDashboard.model"; import { DataTypes, Sequelize } from "sequelize"; -import { statusType, secondChoiceStatusType } from "../types"; +import { statusType, secondChoiceStatusType, ApplicantRole } from "../types"; @Table({ tableName: "applicantresponse" }) diff --git a/backend/typescript/services/implementations/appDashboardService.ts b/backend/typescript/services/implementations/appDashboardService.ts index c37cf96..b0c5b29 100644 --- a/backend/typescript/services/implementations/appDashboardService.ts +++ b/backend/typescript/services/implementations/appDashboardService.ts @@ -3,6 +3,7 @@ import { ApplicationDTO, ApplicationDashboardRowDTO, UserDTO, + ApplicantRole } from "../../types"; import { getErrorMessage } from "../../utilities/errorUtils"; import logger from "../../utilities/logger"; @@ -54,7 +55,7 @@ class AppDashboardService implements IAppDashboardService { }; } - async getApplicationsByRole(role: string): Promise<Array<ApplicationDTO>> { + async getApplicationsByRole(role: ApplicantRole): Promise<Array<ApplicationDTO>> { let applications: Array<Application> | null; let applicationsByRole: Array<Application> | null; let applicationsByRoleDTO: Array<ApplicationDTO> = []; @@ -99,7 +100,7 @@ class AppDashboardService implements IAppDashboardService { return applicationsByRoleDTO; } - async getApplicationsBySecondChoiceRole(role: string): Promise<Array<ApplicationDTO>> { + async getApplicationsBySecondChoiceRole(role: ApplicantRole): Promise<Array<ApplicationDTO>> { let applications: Array<Application> | null; let applicationsBySecondChoiceRole: Array<Application> | null; let applicationsBySecondChoiceRoleDTO: Array<ApplicationDTO> = []; @@ -180,7 +181,7 @@ class AppDashboardService implements IAppDashboardService { } async getApplicationDashboardTable( - role: string, + role: ApplicantRole, ): Promise<ApplicationDashboardRowDTO[]> { // get all the applications for the role const applications: Array<ApplicationDTO> = await this.getApplicationsByRole( @@ -208,7 +209,7 @@ class AppDashboardService implements IAppDashboardService { } async getApplicationBySecondChoiceRoleDashboardTable( - role: string, + role: ApplicantRole, ): Promise<ApplicationDashboardRowDTO[]> { // get all the applications for the role const applications: Array<ApplicationDTO> = await this.getApplicationsBySecondChoiceRole( diff --git a/backend/typescript/services/interfaces/appDashboardService.ts b/backend/typescript/services/interfaces/appDashboardService.ts index 511d898..ec23c30 100644 --- a/backend/typescript/services/interfaces/appDashboardService.ts +++ b/backend/typescript/services/interfaces/appDashboardService.ts @@ -2,20 +2,21 @@ import { ApplicationDashboardDTO, ApplicationDTO, ApplicationDashboardRowDTO, + ApplicantRole } from "../../types"; interface IAppDashboardService { getDashboardById(id: number): Promise<ApplicationDashboardDTO>; - getApplicationsByRole(role: string): Promise<ApplicationDTO[]>; - getApplicationsBySecondChoiceRole(role: string): Promise<ApplicationDTO[]>; + getApplicationsByRole(role: ApplicantRole): Promise<ApplicationDTO[]>; + getApplicationsBySecondChoiceRole(role: ApplicantRole): Promise<ApplicationDTO[]>; getDashboardsByApplicationId( applicationId: number, ): Promise<ApplicationDashboardDTO[]>; getApplicationDashboardTable( - role: string, + role: ApplicantRole, ): Promise<ApplicationDashboardRowDTO[]>; getApplicationBySecondChoiceRoleDashboardTable( - role: string, + role: ApplicantRole, ): Promise<ApplicationDashboardRowDTO[]>; mutateRating( id: number, diff --git a/backend/typescript/types.ts b/backend/typescript/types.ts index 6b2202f..e8edb3a 100644 --- a/backend/typescript/types.ts +++ b/backend/typescript/types.ts @@ -104,3 +104,25 @@ export type NodemailerConfig = { }; export type SignUpMethod = "PASSWORD" | "GOOGLE"; + +export enum ApplicantRole { + pres = "president", // community tab + int_dir = "internal director", + ext_dir = "external director", + vpe = "vp engineering", // eng tab + vpd = "vp design", // design tab + vpp = "vp product", // prod tab + vpt = "vp talent", // community tab + vp_ext = "vp external", // community tab + vp_int = "vp internal", // community tab + vp_comms = "vp communications", // community tab + vp_scoping = "vp scoping", // community tab + vp_finance = "vp finance & operations", // community tab + pm = "project manager", // prod tab + pl = "project lead", // eng tab + design_mentor = "design mentor", // design tab + graphic_design = "graphic designer", // design tab + product_design = "product designer", // design tab + uxr = "user researcher", // design tab + dev = "project developer", // eng tab +}