Skip to content

Commit 7f066c2

Browse files
committed
#1583 merge conflicts
2 parents 1fb34c6 + 3e18f8e commit 7f066c2

140 files changed

Lines changed: 4365 additions & 1791 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/notifications.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ jobs:
1111
steps:
1212
- name: Send notifications
1313
run: |
14-
curl -H "Authorization: ${{ secrets.NOTIFICATION_ENDPOINT_SECRET }}" -X POST "${{ env.BACKEND_URL}}/notifications/task-deadlines"
14+
curl -H "Authorization: ${{ secrets.NOTIFICATION_ENDPOINT_SECRET }}" -X POST "${{ secrets.BACKEND_URL}}/notifications/task-deadlines"

src/backend/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import notificationsRouter from './src/routes/notifications.routes';
1515
import designReviewsRouter from './src/routes/design-reviews.routes';
1616
import workPackageTemplatesRouter from './src/routes/work-package-templates.routes';
1717
import carsRouter from './src/routes/cars.routes';
18+
import organizationRouter from './src/routes/organizations.routes';
1819

1920
const app = express();
2021
const port = process.env.PORT || 3001;
@@ -60,6 +61,7 @@ app.use('/design-reviews', designReviewsRouter);
6061
app.use('/notifications', notificationsRouter);
6162
app.use('/templates', workPackageTemplatesRouter);
6263
app.use('/cars', carsRouter);
64+
app.use('/organizations', organizationRouter);
6365
app.use('/', (_req, res) => {
6466
res.json('Welcome to FinishLine');
6567
});

src/backend/src/controllers/design-reviews.controllers.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,19 @@ export default class DesignReviewsController {
128128
next(error);
129129
}
130130
}
131+
132+
// Set a new status for the design review
133+
static async setStatus(req: Request, res: Response, next: NextFunction) {
134+
try {
135+
const { designReviewId } = req.params;
136+
const { status } = req.body;
137+
const user = await getCurrentUser(res);
138+
const organizationId = getOrganizationId(req.headers);
139+
140+
const updatedDesignReview = await DesignReviewsService.setStatus(user, designReviewId, status, organizationId);
141+
res.status(200).json(updatedDesignReview);
142+
} catch (error: unknown) {
143+
next(error);
144+
}
145+
}
131146
}

src/backend/src/controllers/notifications.controllers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { NextFunction, Request, Response } from 'express';
22
import NotificationsService from '../services/notifications.services';
33

44
export default class NotificationsController {
5-
static async sendTaskDeadlineSlackNotifications(_req: Request, res: Response, next: NextFunction) {
5+
static async sendDailySlackNotifications(_req: Request, res: Response, next: NextFunction) {
66
try {
7-
await NotificationsService.sendTaskDeadlineSlackNotifications();
7+
await NotificationsService.sendDailySlackNotifications();
88

99
res.status(200).json({ message: 'Successfully sent task deadline notifications!' });
1010
} catch (error: unknown) {
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { NextFunction, Request, Response } from 'express';
2+
import { getCurrentUser } from '../utils/auth.utils';
3+
import { getOrganizationId } from '../utils/utils';
4+
import OrganizationsService from '../services/organizations.service';
5+
6+
export default class OrganizationsController {
7+
static async setUsefulLinks(req: Request, res: Response, next: NextFunction) {
8+
try {
9+
const { links } = req.body;
10+
const submitter = await getCurrentUser(res);
11+
const organizationId = getOrganizationId(req.headers);
12+
13+
const newLinks = await OrganizationsService.setUsefulLinks(submitter, organizationId, links);
14+
res.status(200).json(newLinks);
15+
} catch (error: unknown) {
16+
next(error);
17+
}
18+
}
19+
20+
static async getAllUsefulLinks(req: Request, res: Response, next: NextFunction) {
21+
try {
22+
const organizationId = getOrganizationId(req.headers);
23+
24+
const links = await OrganizationsService.getAllUsefulLinks(organizationId);
25+
res.status(200).json(links);
26+
} catch (error: unknown) {
27+
next(error);
28+
}
29+
}
30+
}

src/backend/src/controllers/projects.controllers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import { getOrganizationId } from '../utils/utils';
99
export default class ProjectsController {
1010
static async getAllProjects(req: Request, res: Response, next: NextFunction) {
1111
try {
12+
const includeDeleted = req.params.deleted === 'true';
1213
const organizationId = getOrganizationId(req.headers);
13-
const projects: Project[] = await ProjectsService.getAllProjects(organizationId);
14+
const projects: Project[] = await ProjectsService.getAllProjects(organizationId, includeDeleted);
1415
res.status(200).json(projects);
1516
} catch (error: unknown) {
1617
next(error);

src/backend/src/controllers/reimbursement-requests.controllers.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,23 @@ export default class ReimbursementRequestsController {
295295
}
296296
}
297297

298+
static async leadershipApproveReimbursementRequest(req: Request, res: Response, next: NextFunction) {
299+
try {
300+
const { requestId } = req.params;
301+
const user = await getCurrentUser(res);
302+
const organizationId = getOrganizationId(req.headers);
303+
304+
const reimbursementStatus = await ReimbursementRequestService.leadershipApproveReimbursementRequest(
305+
requestId,
306+
user,
307+
organizationId
308+
);
309+
res.status(200).json(reimbursementStatus);
310+
} catch (error: unknown) {
311+
next(error);
312+
}
313+
}
314+
298315
static async approveReimbursementRequest(req: Request, res: Response, next: NextFunction) {
299316
try {
300317
const { requestId } = req.params;

src/backend/src/controllers/tasks.controllers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { getOrganizationId } from '../utils/utils';
88
export default class TasksController {
99
static async createTask(req: Request, res: Response, next: NextFunction) {
1010
try {
11-
const { title, deadline, priority, status, assignees } = req.body;
11+
const { title, deadline, priority, status, assignees, notes } = req.body;
1212
const wbsNum: WbsNumber = validateWBS(req.params.wbsNum);
1313
const createdBy: User = await getCurrentUser(res);
1414
const organizationId = getOrganizationId(req.headers);
@@ -17,7 +17,7 @@ export default class TasksController {
1717
createdBy,
1818
wbsNum,
1919
title,
20-
'',
20+
notes,
2121
new Date(deadline),
2222
priority,
2323
status,

src/backend/src/prisma-query-args/design-reviews.query-args.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const getDesignReviewQueryArgs = (organizationId: string) =>
1414
deniedMembers: getUserQueryArgs(organizationId),
1515
attendees: getUserQueryArgs(organizationId),
1616
userDeleted: getUserQueryArgs(organizationId),
17-
wbsElement: true
17+
wbsElement: true,
18+
notificationSlackThreads: true
1819
}
1920
});

src/backend/src/prisma-query-args/user.query-args.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export type UserQueryArgs = ReturnType<typeof getUserQueryArgs>;
44

55
export type UserWithSettingsQueryArgs = ReturnType<typeof getUserWithSettingsQueryArgs>;
66

7+
export type UserScheduleSettingsQueryArgs = ReturnType<typeof getUserScheduleSettingsQueryArgs>;
8+
79
// DO NOT CALL ANY OTHER QUERY ARGS FROM HERE TO AVOID CIRCULAR DEPENDENCIES
810
export const getUserQueryArgs = (organizationId: string) =>
911
Prisma.validator<Prisma.UserDefaultArgs>()({
@@ -25,8 +27,16 @@ export const getUserWithSettingsQueryArgs = (organizationId: string) =>
2527
organizationId
2628
}
2729
},
28-
drScheduleSettings: true,
30+
drScheduleSettings: getUserScheduleSettingsQueryArgs(),
2931
userSettings: true,
3032
organizations: true
3133
}
3234
});
35+
36+
export const getUserScheduleSettingsQueryArgs = () => {
37+
return Prisma.validator<Prisma.Schedule_SettingsDefaultArgs>()({
38+
include: {
39+
availabilities: true
40+
}
41+
});
42+
};

0 commit comments

Comments
 (0)