Skip to content

Commit

Permalink
#2708 merge conflitcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaryan1203 committed Sep 6, 2024
2 parents d34660a + b2b1fcc commit 6ef1ddb
Show file tree
Hide file tree
Showing 29 changed files with 793 additions and 186 deletions.
38 changes: 34 additions & 4 deletions src/backend/src/controllers/reimbursement-requests.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ export default class ReimbursementRequestsController {

const createdReimbursementRequest = await ReimbursementRequestService.createReimbursementRequest(
user,
dateOfExpense,
vendorId,
account,
otherReimbursementProducts,
wbsReimbursementProducts,
accountCodeId,
totalCost,
req.organization
req.organization,
dateOfExpense
);
return res.status(200).json(createdReimbursementRequest);
} catch (error: unknown) {
Expand Down Expand Up @@ -111,7 +111,6 @@ export default class ReimbursementRequestsController {

const updatedReimbursementRequestId = await ReimbursementRequestService.editReimbursementRequest(
requestId,
dateOfExpense,
vendorId,
account,
accountCodeId,
Expand All @@ -120,7 +119,8 @@ export default class ReimbursementRequestsController {
wbsReimbursementProducts,
receiptPictures,
req.currentUser,
req.organization
req.organization,
dateOfExpense
);
return res.status(200).json(updatedReimbursementRequestId);
} catch (error: unknown) {
Expand Down Expand Up @@ -411,4 +411,34 @@ export default class ReimbursementRequestsController {
return next(error);
}
}

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

const updatedRequest = await ReimbursementRequestService.markPendingFinance(
req.currentUser,
requestId,
req.organization
);
res.status(200).json(updatedRequest);
} catch (error: unknown) {
next(error);
}
}

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

const updatedRequest = await ReimbursementRequestService.financeRequestReimbursementRequestChanges(
req.currentUser,
requestId,
req.organization
);
res.status(200).json(updatedRequest);
} catch (error: unknown) {
next(error);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const getReimbursementRequestQueryArgs = (organizationId: string) =>
dateDeleted: null
},
...getReimbursementProductQueryArgs(organizationId)
}
},
notificationSlackThreads: true
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- AlterEnum
ALTER TYPE "Reimbursement_Status_Type" ADD VALUE 'LEADERSHIP_APPROVED';

-- AlterTable
ALTER TABLE "Message_Info" ADD COLUMN "reimbursementRequestId" TEXT;

-- AlterTable
ALTER TABLE "Reimbursement_Request" ALTER COLUMN "dateOfExpense" DROP NOT NULL;

-- AddForeignKey
ALTER TABLE "Message_Info" ADD CONSTRAINT "Message_Info_reimbursementRequestId_fkey" FOREIGN KEY ("reimbursementRequestId") REFERENCES "Reimbursement_Request"("reimbursementRequestId") ON DELETE SET NULL ON UPDATE CASCADE;
52 changes: 28 additions & 24 deletions src/backend/src/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ enum Club_Accounts {

enum Reimbursement_Status_Type {
PENDING_LEADERSHIP_APPROVAL
LEADERSHIP_APPROVED
PENDING_FINANCE
SABO_SUBMITTED
ADVISOR_APPROVED
Expand Down Expand Up @@ -266,10 +267,12 @@ model Message_Info {
channelId String
timestamp String
changeRequestId String?
changeRequest Change_Request? @relation(fields: [changeRequestId], references: [crId])
designReviewId String?
designReview Design_Review? @relation(fields: [designReviewId], references: [designReviewId])
changeRequestId String?
changeRequest Change_Request? @relation(fields: [changeRequestId], references: [crId])
designReviewId String?
designReview Design_Review? @relation(fields: [designReviewId], references: [designReviewId])
reimbursementRequestId String?
reimbursementRequest Reimbursement_Request? @relation(fields: [reimbursementRequestId], references: [reimbursementRequestId])
}

model Scope_CR {
Expand Down Expand Up @@ -520,26 +523,27 @@ model Receipt {
}

model Reimbursement_Request {
reimbursementRequestId String @id @default(uuid())
identifier Int
saboId Int? @unique
dateCreated DateTime @default(now())
dateDeleted DateTime?
dateOfExpense DateTime
reimbursementStatuses Reimbursement_Status[]
recipientId String
recipient User @relation(name: "reimbursementRequestRecipient", fields: [recipientId], references: [userId])
vendorId String
vendor Vendor @relation(fields: [vendorId], references: [vendorId])
account Club_Accounts
totalCost Int
receiptPictures Receipt[]
reimbursementProducts Reimbursement_Product[]
dateDelivered DateTime?
accountCodeId String
accountCode Account_Code @relation(fields: [accountCodeId], references: [accountCodeId])
organizationId String
organization Organization @relation(fields: [organizationId], references: [organizationId])
reimbursementRequestId String @id @default(uuid())
identifier Int
saboId Int? @unique
dateCreated DateTime @default(now())
dateDeleted DateTime?
dateOfExpense DateTime?
reimbursementStatuses Reimbursement_Status[]
recipientId String
recipient User @relation(name: "reimbursementRequestRecipient", fields: [recipientId], references: [userId])
vendorId String
vendor Vendor @relation(fields: [vendorId], references: [vendorId])
account Club_Accounts
totalCost Int
receiptPictures Receipt[]
reimbursementProducts Reimbursement_Product[]
dateDelivered DateTime?
accountCodeId String
accountCode Account_Code @relation(fields: [accountCodeId], references: [accountCodeId])
organizationId String
organization Organization @relation(fields: [organizationId], references: [organizationId])
notificationSlackThreads Message_Info[]
@@unique([identifier, organizationId], name: "uniqueReimbursementRequest")
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/src/prisma/seed-data/teams.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const financeTeam = (headId: string, organizationId: string): Prisma.TeamCreateA
return {
data: {
teamName: 'financeTeam',
slackId: 'finance',
slackId: 'financerand',
headId,
organizationId,
financeTeam: true
Expand Down
5 changes: 2 additions & 3 deletions src/backend/src/prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,6 @@ const performSeed: () => Promise<void> = async () => {

await ReimbursementRequestService.createReimbursementRequest(
thomasEmrax,
new Date(),
vendor.vendorId,
ClubAccount.CASH,
[],
Expand All @@ -1654,7 +1653,6 @@ const performSeed: () => Promise<void> = async () => {

await ReimbursementRequestService.createReimbursementRequest(
thomasEmrax,
new Date(),
vendor.vendorId,
ClubAccount.BUDGET,
[],
Expand All @@ -1671,7 +1669,8 @@ const performSeed: () => Promise<void> = async () => {
],
accountCode.accountCodeId,
200,
ner
ner,
new Date()
);

/**
Expand Down
15 changes: 13 additions & 2 deletions src/backend/src/routes/reimbursement-requests.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
intMinZero,
isAccount,
isDate,
isOptionalDate,
nonEmptyString,
validateInputs,
validateReimbursementProducts
Expand Down Expand Up @@ -41,7 +42,7 @@ reimbursementRequestsRouter.post('/:vendorId/vendors/delete', ReimbursementReque

reimbursementRequestsRouter.post(
'/create',
isDate(body('dateOfExpense')),
isOptionalDate(body('dateOfExpense')),
nonEmptyString(body('vendorId')),
isAccount(body('account')),
nonEmptyString(body('accountCodeId')),
Expand All @@ -57,7 +58,7 @@ reimbursementRequestsRouter.get('/:requestId', ReimbursementRequestController.ge

reimbursementRequestsRouter.post(
'/:requestId/edit',
isDate(body('dateOfExpense')),
isOptionalDate(body('dateOfExpense')),
nonEmptyString(body('vendorId')),
isAccount(body('account')),
body('receiptPictures').isArray(),
Expand Down Expand Up @@ -156,4 +157,14 @@ reimbursementRequestsRouter.post(

reimbursementRequestsRouter.get('/receipt-image/:fileId', ReimbursementRequestController.downloadReceiptImage);

reimbursementRequestsRouter.post(
'/:requestId/request-changes',
ReimbursementRequestController.requestReimbursementRequestChanges
);

reimbursementRequestsRouter.post(
'/:requestId/pending-finance',
ReimbursementRequestController.markReimbursementRequestAsPendingFinance
);

export default reimbursementRequestsRouter;
Loading

0 comments on commit 6ef1ddb

Please sign in to comment.