Skip to content

Commit

Permalink
Merge pull request #3119 from Northeastern-Electric-Racing/feature/re…
Browse files Browse the repository at this point in the history
…cruitment_and_onboarding

Feature/recruitment and onboarding
  • Loading branch information
Peyton-McKee authored Jan 21, 2025
2 parents 0644a1b + debf30a commit c4c7e8c
Show file tree
Hide file tree
Showing 190 changed files with 13,178 additions and 9,247 deletions.
22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,26 @@
"@types/react-dom": "17.0.1"
},
"dependencies": {
"@slack/events-api": "^3.0.1",
"mitt": "^3.0.1",
"react-hook-form-persist": "^3.0.0",
"typescript": "^4.1.5"
"typescript": "^5.7.3"
},
"devDependencies": {
"@babel/core": "^7.20.5",
"@babel/plugin-transform-object-assign": "^7.18.6",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@types/jest": "^28.1.6",
"@types/node": "18.17.1",
"@typescript-eslint/eslint-plugin": "4.18.0",
"@typescript-eslint/parser": "4.18.0",
"concurrently": "^5.2.0",
"@types/jest": "^29.5.14",
"@types/node": "20.0.0",
"@typescript-eslint/eslint-plugin": "8.20.0",
"@typescript-eslint/parser": "8.20.0",
"concurrently": "^9.1.0",
"eslint": "^7.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-prettier": "^10.0.1",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-cypress": "latest",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.0.5",
"rimraf": "^3.0.2",
"eslint-plugin-prettier": "^5.2.2",
"prettier": "^3.4.2",
"rimraf": "^6.0.1",
"ts-node": "^10.9.1"
},
"eslintConfig": {
Expand Down
7 changes: 4 additions & 3 deletions src/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"dependencies": {
"@prisma/client": "^5.7.1",
"@slack/events-api": "^3.0.1",
"@slack/web-api": "^6.7.2",
"@types/concat-stream": "^2.0.0",
"@types/cookie-parser": "^1.4.3",
Expand All @@ -36,15 +37,15 @@
"devDependencies": {
"@types/express-jwt": "^6.0.4",
"@types/jsonwebtoken": "^8.5.9",
"@types/node": "18.17.1",
"@types/node": "^20.0.0",
"@types/supertest": "^2.0.12",
"nodemon": "^2.0.16",
"prisma": "^5.7.1",
"supertest": "^6.2.4",
"ts-jest": "^26.2.0",
"ts-node": "^8.10.1",
"typescript": "^4.1.5",
"vitest": "^0.32.1"
"typescript": "^5.7.3",
"vitest": "^2.1.8"
},
"main": "index.ts",
"prisma": {
Expand Down
21 changes: 0 additions & 21 deletions src/backend/src/controllers/onboarding.controller.ts

This file was deleted.

110 changes: 110 additions & 0 deletions src/backend/src/controllers/onboarding.controllers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import { NextFunction, Request, Response } from 'express';
import OnboardingServices from '../services/onboarding.services';

export default class OnboardingController {
/* Checklists section */
static async getAllChecklists(req: Request, res: Response, next: NextFunction) {
try {
const checklists = await OnboardingServices.getAllChecklists(req.organization);
res.status(200).json(checklists);
} catch (error: unknown) {
return next(error);
}
}

static async getCheckedChecklists(req: Request, res: Response, next: NextFunction) {
try {
const checkedChecklists = await OnboardingServices.getCheckedChecklists(req.currentUser, req.organization);
res.status(200).json(checkedChecklists);
} catch (error: unknown) {
return next(error);
}
}

static async getUsersChecklists(req: Request, res: Response, next: NextFunction) {
try {
const checklists = await OnboardingServices.getUsersChecklists(req.currentUser.userId, req.organization);
res.status(200).json(checklists);
} catch (error: unknown) {
return next(error);
}
}

static async createChecklist(req: Request, res: Response, next: NextFunction) {
try {
const { name, descriptions, isOptional, teamId, teamTypeId, parentChecklistId } = req.body;
const checklist = await OnboardingServices.createChecklist(
req.currentUser,
name,
descriptions,
teamId,
teamTypeId,
parentChecklistId,
req.organization,
isOptional
);
res.status(200).json(checklist);
} catch (error: unknown) {
return next(error);
}
}

static async editChecklist(req: Request, res: Response, next: NextFunction) {
try {
const { checklistId } = req.params;
const { name, descriptions, isOptional, teamId, teamTypeId, parentChecklistId } = req.body;
const checklist = await OnboardingServices.editChecklist(
req.currentUser,
checklistId,
name,
descriptions,
teamId,
teamTypeId,
parentChecklistId,
req.organization,
isOptional
);
res.status(200).json(checklist);
} catch (error: unknown) {
return next(error);
}
}

static async deleteChecklist(req: Request, res: Response, next: NextFunction) {
try {
const { checklistId } = req.params;
await OnboardingServices.deleteChecklist(req.currentUser, checklistId, req.organization);
res.status(200).json({ message: 'Checklist deleted successfully' });
} catch (error: unknown) {
return next(error);
}
}

static async toggleChecklist(req: Request, res: Response, next: NextFunction) {
try {
const { checklistId } = req.params;

const updatedItem = await OnboardingServices.toggleChecklist(checklistId, req.currentUser, req.organization);
res.status(200).json(updatedItem);
} catch (error: unknown) {
return next(error);
}
}

static async downloadImage(req: Request, res: Response, next: NextFunction) {
try {
const { fileId } = req.params;

const imageData = await OnboardingServices.downloadImage(fileId);

// Set the appropriate headers for the HTTP response
res.setHeader('content-type', String(imageData.type));
res.setHeader('content-length', imageData.buffer.length);

// Send the Buffer as the response body
res.send(imageData.buffer);
} catch (error: unknown) {
return next(error);
}
}
}
44 changes: 44 additions & 0 deletions src/backend/src/controllers/organizations.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,50 @@ export default class OrganizationsController {
}
}

static async updateApplicationLink(req: Request, res: Response, next: NextFunction) {
try {
const { applicationLink } = req.body;
const updatedOrganization = await OrganizationsService.updateApplicationLink(
req.currentUser,
applicationLink,
req.organization
);
res.status(200).json(updatedOrganization);
} catch (error: unknown) {
next(error);
}
}

static async setOnboardingText(req: Request, res: Response, next: NextFunction) {
try {
const { onboardingText } = req.body;
const updatedOrganization = await OrganizationsService.setOnboardingText(
req.currentUser,
req.organization,
onboardingText
);
res.status(200).json(updatedOrganization);
} catch (error: unknown) {
next(error);
}
}

static async updateOrganizationContacts(req: Request, res: Response, next: NextFunction) {
try {
const { contacts } = req.body;

const updatedOrganization = await OrganizationsService.updateOrganizationContacts(
req.currentUser,
req.organization,
contacts
);

res.status(200).json(updatedOrganization);
} catch (error: unknown) {
next(error);
}
}

static async getOrganizationImages(req: Request, res: Response, next: NextFunction) {
try {
const images = await OrganizationsService.getOrganizationImages(req.organization.organizationId);
Expand Down
26 changes: 24 additions & 2 deletions src/backend/src/controllers/teams.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export default class TeamsController {
static async setTeamMembers(req: Request, res: Response, next: NextFunction) {
try {
const { userIds } = req.body;

const { teamId } = req.params;
// update the team with the input fields
const updateTeam = await TeamsService.setTeamMembers(req.currentUser, req.params.teamId, userIds, req.organization);
const updateTeam = await TeamsService.setTeamMembers(req.currentUser, teamId, userIds, req.organization);

// the updated team
res.status(200).json(updateTeam);
Expand Down Expand Up @@ -138,6 +138,28 @@ export default class TeamsController {
}
}

static async setOnboardingUser(req: Request, res: Response, next: NextFunction) {
try {
const { teamTypeId } = req.params;

const updatedTeamType = await TeamsService.setOnboardingUser(req.currentUser, teamTypeId, req.organization);

res.status(200).json(updatedTeamType);
} catch (error: unknown) {
next(error);
}
}

static async completeOnboarding(req: Request, res: Response, next: NextFunction) {
try {
await TeamsService.completeOnboarding(req.currentUser, req.organization);

res.status(200).json({ message: 'Successfully completed onboarding' });
} catch (error: unknown) {
next(error);
}
}

static async getSingleTeamType(req: Request, res: Response, next: NextFunction) {
try {
const { teamTypeId } = req.params;
Expand Down
5 changes: 5 additions & 0 deletions src/backend/src/prisma-query-args/auth-user.query-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ export const getAuthUserQueryArgs = (organizationId: string) =>
organizationId
}
}
},
onboardingTeamTypes: {
where: {
organizationId
}
}
}
});

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit c4c7e8c

Please sign in to comment.