Skip to content

Commit 22f2487

Browse files
committed
Merge branch 'develop' into 3604-maintenence---tracking-spending-on-project-overview
2 parents 309ee76 + 7849791 commit 22f2487

102 files changed

Lines changed: 8143 additions & 1940 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.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@
6666
"@types/react-dom": "17.0.1"
6767
},
6868
"dependencies": {
69+
"@microsoft/clarity": "^1.0.0",
6970
"@types/multer": "^1.4.12",
71+
"canvas-confetti": "^1.9.3",
7072
"mitt": "^3.0.1",
7173
"react-hook-form-persist": "^3.0.0",
7274
"recharts": "^2.15.3",
@@ -77,6 +79,7 @@
7779
"@babel/plugin-transform-object-assign": "^7.18.6",
7880
"@babel/preset-react": "^7.18.6",
7981
"@babel/preset-typescript": "^7.18.6",
82+
"@types/canvas-confetti": "^1.9.0",
8083
"@types/jest": "^29.5.14",
8184
"@types/node": "20.0.0",
8285
"@typescript-eslint/eslint-plugin": "8.20.0",

src/backend/src/controllers/organizations.controllers.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,27 @@ export default class OrganizationsController {
217217
next(error);
218218
}
219219
}
220+
221+
static async getFinanceDelegates(req: Request, res: Response, next: NextFunction) {
222+
try {
223+
const financeDelegates = await OrganizationsService.getFinanceDelegates(req.organization.organizationId);
224+
res.status(200).json(financeDelegates);
225+
} catch (error: unknown) {
226+
next(error);
227+
}
228+
}
229+
230+
static async setFinanceDelegates(req: Request, res: Response, next: NextFunction) {
231+
try {
232+
const { userIds } = req.body;
233+
const updatedDelegates = await OrganizationsService.setFinanceDelegates(
234+
req.currentUser,
235+
req.organization.organizationId,
236+
userIds
237+
);
238+
res.status(200).json(updatedDelegates);
239+
} catch (error: unknown) {
240+
next(error);
241+
}
242+
}
220243
}

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

Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ export default class ReimbursementRequestsController {
2323
}
2424
}
2525

26+
static async getCurrentUserAssignedReimbursementRequests(req: Request, res: Response, next: NextFunction) {
27+
try {
28+
const assignedReimbursementRequests = await ReimbursementRequestService.getUserAssignedReimbursementRequests(
29+
req.currentUser,
30+
req.organization
31+
);
32+
res.status(200).json(assignedReimbursementRequests);
33+
} catch (error: unknown) {
34+
next(error);
35+
}
36+
}
37+
2638
static async getCurrentUserReimbursements(req: Request, res: Response, next: NextFunction) {
2739
try {
2840
const userReimbursements = await ReimbursementRequestService.getUserReimbursements(req.currentUser, req.organization);
@@ -140,6 +152,23 @@ export default class ReimbursementRequestsController {
140152
}
141153
}
142154

155+
static async assignFinanceMember(req: Request, res: Response, next: NextFunction) {
156+
try {
157+
const { requestId } = req.params;
158+
const { assigneeId } = req.body;
159+
160+
const updatedReimbursementRequest = await ReimbursementRequestService.assignFinanceMember(
161+
req.currentUser,
162+
req.organization,
163+
requestId,
164+
assigneeId
165+
);
166+
res.status(200).json(updatedReimbursementRequest);
167+
} catch (error: unknown) {
168+
next(error);
169+
}
170+
}
171+
143172
static async editReimbursement(req: Request, res: Response, next: NextFunction) {
144173
try {
145174
const { reimbursementId } = req.params;
@@ -217,8 +246,8 @@ export default class ReimbursementRequestsController {
217246
req.currentUser,
218247
name,
219248
req.organization,
220-
taxExempt,
221-
twoFactorContacts,
249+
taxExempt ?? false,
250+
twoFactorContacts ?? [],
222251
notes,
223252
username,
224253
password,
@@ -300,11 +329,26 @@ export default class ReimbursementRequestsController {
300329
}
301330
}
302331

303-
static async approveReimbursementRequest(req: Request, res: Response, next: NextFunction) {
332+
static async inputReimbursementRequestInSabo(req: Request, res: Response, next: NextFunction) {
304333
try {
305334
const { requestId } = req.params;
306335

307-
const reimbursementStatus = await ReimbursementRequestService.approveReimbursementRequest(
336+
const reimbursementStatus = await ReimbursementRequestService.inputReimbursementRequestInSabo(
337+
requestId,
338+
req.currentUser,
339+
req.organization
340+
);
341+
res.status(200).json(reimbursementStatus);
342+
} catch (error: unknown) {
343+
next(error);
344+
}
345+
}
346+
347+
static async markReimbursementRequestAsSaboSubmitted(req: Request, res: Response, next: NextFunction) {
348+
try {
349+
const { requestId } = req.params;
350+
351+
const reimbursementStatus = await ReimbursementRequestService.markReimbursementRequestAsSaboSubmitted(
308352
requestId,
309353
req.currentUser,
310354
req.organization
@@ -525,6 +569,23 @@ export default class ReimbursementRequestsController {
525569
}
526570
}
527571

572+
static async editIndexCode(req: Request, res: Response, next: NextFunction) {
573+
try {
574+
const { name, code } = req.body;
575+
const { indexCodeId } = req.params;
576+
const updatedIndexCode = await ReimbursementRequestService.editIndexCode(
577+
req.currentUser,
578+
req.organization,
579+
indexCodeId,
580+
name,
581+
code
582+
);
583+
res.status(200).json(updatedIndexCode);
584+
} catch (error: unknown) {
585+
next(error);
586+
}
587+
}
588+
528589
static async deleteIndexCode(req: Request, res: Response, next: NextFunction) {
529590
try {
530591
const { indexCodeId } = req.params;

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { validateWBS, WbsNumber } from 'shared';
55
export default class TasksController {
66
static async createTask(req: Request, res: Response, next: NextFunction) {
77
try {
8-
const { title, deadline, priority, status, assignees, notes } = req.body;
8+
const { title, deadline, startDate, priority, status, assignees, notes } = req.body;
99
const wbsNum: WbsNumber = validateWBS(req.params.wbsNum);
1010

1111
const task = await TasksService.createTask(
@@ -17,6 +17,7 @@ export default class TasksController {
1717
status,
1818
assignees,
1919
req.organization,
20+
startDate ? new Date(startDate) : undefined,
2021
deadline ? new Date(deadline) : undefined
2122
);
2223

@@ -28,7 +29,7 @@ export default class TasksController {
2829

2930
static async editTask(req: Request, res: Response, next: NextFunction) {
3031
try {
31-
const { title, notes, priority, deadline } = req.body;
32+
const { title, notes, priority, deadline, startDate } = req.body;
3233
const { taskId } = req.params;
3334

3435
const updateTask = await TasksService.editTask(
@@ -38,7 +39,8 @@ export default class TasksController {
3839
title,
3940
notes,
4041
priority,
41-
deadline
42+
startDate ? new Date(startDate) : undefined,
43+
deadline ? new Date(deadline) : undefined
4244
);
4345

4446
res.status(200).json(updateTask);

src/backend/src/prisma-query-args/reimbursement-requests.query-args.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const getReimbursementRequestQueryArgs = (organizationId: string) =>
3131
dateDeleted: null
3232
},
3333
...getReimbursementRequestCommentQueryArgs(organizationId)
34-
}
34+
},
35+
assignee: getUserQueryArgs(organizationId)
3536
}
3637
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-- AlterEnum
2+
ALTER TYPE "public"."Reimbursement_Status_Type" ADD VALUE 'PENDING_SABO_SUBMISSION';
3+
4+
-- CreateTable
5+
CREATE TABLE "public"."_financeDelegates" (
6+
"A" TEXT NOT NULL,
7+
"B" TEXT NOT NULL,
8+
9+
CONSTRAINT "_financeDelegates_AB_pkey" PRIMARY KEY ("A","B")
10+
);
11+
12+
-- CreateIndex
13+
CREATE INDEX "_financeDelegates_B_index" ON "public"."_financeDelegates"("B");
14+
15+
-- AddForeignKey
16+
ALTER TABLE "public"."_financeDelegates" ADD CONSTRAINT "_financeDelegates_A_fkey" FOREIGN KEY ("A") REFERENCES "public"."Organization"("organizationId") ON DELETE CASCADE ON UPDATE CASCADE;
17+
18+
-- AddForeignKey
19+
ALTER TABLE "public"."_financeDelegates" ADD CONSTRAINT "_financeDelegates_B_fkey" FOREIGN KEY ("B") REFERENCES "public"."User"("userId") ON DELETE CASCADE ON UPDATE CASCADE;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "public"."Task" ADD COLUMN "startDate" TIMESTAMP(3);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- AlterTable
2+
ALTER TABLE "Reimbursement_Request" ADD COLUMN "assigneeId" TEXT;
3+
4+
-- AddForeignKey
5+
ALTER TABLE "Reimbursement_Request" ADD CONSTRAINT "Reimbursement_Request_assigneeId_fkey" FOREIGN KEY ("assigneeId") REFERENCES "User"("userId") ON DELETE SET NULL ON UPDATE CASCADE;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Please do not edit this file manually
22
# It should be added in your version-control system (e.g., Git)
3-
provider = "postgresql"
3+
provider = "postgresql"

src/backend/src/prisma/schema.prisma

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ enum Reimbursement_Status_Type {
7878
PENDING_LEADERSHIP_APPROVAL
7979
LEADERSHIP_APPROVED
8080
PENDING_FINANCE
81+
PENDING_SABO_SUBMISSION
8182
SABO_SUBMITTED
8283
ADVISOR_APPROVED
8384
REIMBURSED
@@ -258,6 +259,8 @@ model User {
258259
reimbursementRequestComments Reimbursement_Request_Comment[] @relation(name: "createdReimbursementRequestComments")
259260
deletedReimbursementRequestComments Reimbursement_Request_Comment[] @relation(name: "deletedReimbursementRequestComments")
260261
deletedSponsorTiers Sponsor_Tier[]
262+
financeDelegateForOrganizations Organization[] @relation(name: "financeDelegates")
263+
assignedReimbursementRequests Reimbursement_Request[] @relation(name: "reimbursementRequestAssignee")
261264
}
262265

263266
model Role {
@@ -630,6 +633,7 @@ model Task {
630633
title String
631634
notes String
632635
deadline DateTime?
636+
startDate DateTime?
633637
assignees User[] @relation(name: "assignedTo")
634638
priority Task_Priority
635639
status Task_Status
@@ -698,6 +702,8 @@ model Reimbursement_Request {
698702
notificationSlackThreads Message_Info[]
699703
materials Material[]
700704
reimbursementComments Reimbursement_Request_Comment[]
705+
assigneeId String?
706+
assignee User? @relation(name: "reimbursementRequestAssignee", fields: [assigneeId], references: [userId])
701707
702708
@@unique([identifier, organizationId], name: "uniqueReimbursementRequest")
703709
@@index([organizationId])
@@ -1205,6 +1211,7 @@ model Organization {
12051211
sponsors Sponsor[]
12061212
sponsorTiers Sponsor_Tier[]
12071213
indexCodes Index_Code[]
1214+
financeDelegates User[] @relation(name: "financeDelegates")
12081215
}
12091216

12101217
model FrequentlyAskedQuestion {

0 commit comments

Comments
 (0)