Skip to content

Commit 701b1a4

Browse files
committed
Merge branch 'develop' into #4032-maintenance-calendar-notifications
2 parents 847dd0e + 0ef78a3 commit 701b1a4

88 files changed

Lines changed: 1672 additions & 1103 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.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,5 @@ eb-deploy/
7070

7171
# Claude Code Files
7272
CLAUDE.md
73-
.playwright-mcp/
73+
.playwright-mcp/
74+
docs/

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,25 @@ export default class ChangeRequestsController {
140140
}
141141
}
142142

143+
static async createLeadershipChangeRequest(req: Request, res: Response, next: NextFunction) {
144+
try {
145+
const { wbsNum, leadId, managerId } = req.body;
146+
147+
const cr = await ChangeRequestsService.createLeadershipChangeRequest(
148+
req.currentUser,
149+
wbsNum.carNumber,
150+
wbsNum.projectNumber,
151+
wbsNum.workPackageNumber,
152+
leadId,
153+
managerId,
154+
req.organization
155+
);
156+
res.status(200).json(cr);
157+
} catch (error: unknown) {
158+
next(error);
159+
}
160+
}
161+
143162
static async createStandardChangeRequest(req: Request, res: Response, next: NextFunction) {
144163
try {
145164
const { wbsNum, type, what, why, proposedSolutions, projectProposedChanges, workPackageProposedChanges } = req.body;

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

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,6 @@ export default class OrganizationsController {
2222
}
2323
}
2424

25-
static async setImages(req: Request, res: Response, next: NextFunction) {
26-
try {
27-
const { applyInterestImage = [], exploreAsGuestImage = [] } = req.files as {
28-
applyInterestImage?: Express.Multer.File[];
29-
exploreAsGuestImage?: Express.Multer.File[];
30-
};
31-
32-
const applyInterestFile = applyInterestImage[0] || null;
33-
const exploreAsGuestFile = exploreAsGuestImage[0] || null;
34-
35-
const newImages = await OrganizationsService.setImages(
36-
applyInterestFile,
37-
exploreAsGuestFile,
38-
req.currentUser,
39-
req.organization
40-
);
41-
42-
res.status(200).json(newImages);
43-
} catch (error: unknown) {
44-
next(error);
45-
}
46-
}
4725
static async getAllUsefulLinks(req: Request, res: Response, next: NextFunction) {
4826
try {
4927
const links = await OrganizationsService.getAllUsefulLinks(req.organization.organizationId);
@@ -97,15 +75,6 @@ export default class OrganizationsController {
9775
}
9876
}
9977

100-
static async getOrganizationImages(req: Request, res: Response, next: NextFunction) {
101-
try {
102-
const images = await OrganizationsService.getOrganizationImages(req.organization.organizationId);
103-
res.status(200).json(images);
104-
} catch (error: unknown) {
105-
next(error);
106-
}
107-
}
108-
10978
static async setOrganizationFeaturedProjects(req: Request, res: Response, next: NextFunction) {
11079
try {
11180
const { projectIds } = req.body;
@@ -142,6 +111,20 @@ export default class OrganizationsController {
142111
}
143112
}
144113

114+
static async setPlatformLogoImage(req: Request, res: Response, next: NextFunction) {
115+
try {
116+
if (!req.file) {
117+
throw new HttpException(400, 'Invalid or undefined image data');
118+
}
119+
120+
const updatedOrg = await OrganizationsService.setPlatformLogoImage(req.file, req.currentUser, req.organization);
121+
122+
res.status(200).json(updatedOrg);
123+
} catch (error: unknown) {
124+
next(error);
125+
}
126+
}
127+
145128
static async setNewMemberImage(req: Request, res: Response, next: NextFunction) {
146129
try {
147130
if (!req.file) {
@@ -181,6 +164,20 @@ export default class OrganizationsController {
181164
}
182165
}
183166

167+
static async setPlatformDescription(req: Request, res: Response, next: NextFunction) {
168+
try {
169+
const updatedOrg = await OrganizationsService.setPlatformDescription(
170+
req.body.platformDescription,
171+
req.currentUser,
172+
req.organization
173+
);
174+
175+
res.status(200).json(updatedOrg);
176+
} catch (error: unknown) {
177+
next(error);
178+
}
179+
}
180+
184181
static async getOrganizationFeaturedProjects(req: Request, res: Response, next: NextFunction) {
185182
try {
186183
const featuredProjects = await OrganizationsService.getOrganizationFeaturedProjects(req.organization.organizationId);

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,16 @@ export default class ProjectsController {
166166

167167
static async createLinkType(req: Request, res: Response, next: NextFunction) {
168168
try {
169-
const { name, iconName, required } = req.body;
169+
const { name, iconName, required, isOnGuestHomePage } = req.body;
170170

171-
const newLinkType = await ProjectsService.createLinkType(req.currentUser, name, iconName, required, req.organization);
171+
const newLinkType = await ProjectsService.createLinkType(
172+
req.currentUser,
173+
name,
174+
iconName,
175+
required,
176+
req.organization,
177+
isOnGuestHomePage
178+
);
172179
res.status(200).json(newLinkType);
173180
} catch (error: unknown) {
174181
next(error);
@@ -207,8 +214,7 @@ export default class ProjectsController {
207214
price,
208215
subtotal,
209216
linkUrl,
210-
notes,
211-
reimbursementRequestId
217+
notes
212218
} = req.body;
213219
const wbsNum = validateWBS(req.params.wbsNum as string);
214220
const material = await BillOfMaterialsService.createMaterial(
@@ -227,8 +233,7 @@ export default class ProjectsController {
227233
notes,
228234
assemblyId,
229235
pdmFileName,
230-
unitName,
231-
reimbursementRequestId
236+
unitName
232237
);
233238
res.status(200).json(material);
234239
} catch (error: unknown) {
@@ -386,8 +391,7 @@ export default class ProjectsController {
386391
price,
387392
subtotal,
388393
linkUrl,
389-
notes,
390-
reimbursementRequestId
394+
notes
391395
} = req.body;
392396
const updatedMaterial = await BillOfMaterialsService.editMaterial(
393397
req.currentUser,
@@ -405,8 +409,7 @@ export default class ProjectsController {
405409
notes,
406410
unitName,
407411
assemblyId,
408-
pdmFileName,
409-
reimbursementRequestId
412+
pdmFileName
410413
);
411414
res.status(200).json(updatedMaterial);
412415
} catch (error: unknown) {
@@ -453,13 +456,14 @@ export default class ProjectsController {
453456
static async editLinkType(req: Request, res: Response, next: NextFunction) {
454457
try {
455458
const { linkTypeName } = req.params as Record<string, string>;
456-
const { name: newName, iconName, required } = req.body;
459+
const { name: newName, iconName, required, isOnGuestHomePage } = req.body;
457460
const linkTypeUpdated = await ProjectsService.editLinkType(
458461
linkTypeName,
459462
iconName,
460463
required,
461464
req.currentUser,
462465
req.organization,
466+
isOnGuestHomePage,
463467
newName
464468
);
465469
res.status(200).json(linkTypeUpdated);

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ export default class ReimbursementRequestsController {
8383
otherReimbursementProducts,
8484
wbsReimbursementProducts,
8585
accountCodeId,
86-
totalCost
86+
totalCost,
87+
description
8788
} = req.body;
8889
const user = await getCurrentUserWithUserSettings(res);
8990

@@ -96,7 +97,8 @@ export default class ReimbursementRequestsController {
9697
accountCodeId,
9798
totalCost,
9899
req.organization,
99-
dateOfExpense
100+
dateOfExpense,
101+
description
100102
);
101103
res.status(200).json(createdReimbursementRequest);
102104
} catch (error: unknown) {
@@ -130,7 +132,8 @@ export default class ReimbursementRequestsController {
130132
totalCost,
131133
otherReimbursementProducts,
132134
wbsReimbursementProducts,
133-
receiptPictures
135+
receiptPictures,
136+
description
134137
} = req.body;
135138

136139
const updatedReimbursementRequestId = await ReimbursementRequestService.editReimbursementRequest(
@@ -144,7 +147,8 @@ export default class ReimbursementRequestsController {
144147
receiptPictures,
145148
req.currentUser,
146149
req.organization,
147-
dateOfExpense
150+
dateOfExpense,
151+
description
148152
);
149153
res.status(200).json(updatedReimbursementRequestId);
150154
} catch (error: unknown) {

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

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Prisma } from '@prisma/client';
22
import { getUserQueryArgs } from './user.query-args.js';
3-
import { getReimbursementRequestQueryArgs } from './reimbursement-requests.query-args.js';
43

54
export type AssemblyQueryArgs = ReturnType<typeof getAssemblyQueryArgs>;
65

@@ -25,20 +24,42 @@ export const getMaterialQueryArgs = (organizationId: string) =>
2524
materialType: true,
2625
unit: true,
2726
manufacturer: true,
28-
reimbursementProducts: false,
29-
reimbursementRequest: getReimbursementRequestQueryArgs(organizationId)
27+
reimbursementProducts: {
28+
where: { dateDeleted: null },
29+
select: {
30+
dateDeleted: true,
31+
reimbursementRequest: {
32+
select: {
33+
reimbursementRequestId: true,
34+
identifier: true,
35+
dateDeleted: true
36+
}
37+
}
38+
}
39+
}
3040
}
3141
});
3242

3343
export type MaterialPreviewQueryArgs = ReturnType<typeof getMaterialPreviewQueryArgs>;
3444

35-
export const getMaterialPreviewQueryArgs = (organizationId: string) =>
45+
export const getMaterialPreviewQueryArgs = (_organizationId: string) =>
3646
Prisma.validator<Prisma.MaterialDefaultArgs>()({
3747
include: {
3848
unit: true,
3949
manufacturer: true,
4050
materialType: true,
41-
reimbursementProducts: false,
42-
reimbursementRequest: getReimbursementRequestQueryArgs(organizationId)
51+
reimbursementProducts: {
52+
where: { dateDeleted: null },
53+
select: {
54+
dateDeleted: true,
55+
reimbursementRequest: {
56+
select: {
57+
reimbursementRequestId: true,
58+
identifier: true,
59+
dateDeleted: true
60+
}
61+
}
62+
}
63+
}
4364
}
4465
});

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ export const getChangeRequestQueryArgs = (organizationId: string) =>
3939
},
4040
budgetChangeRequest: true,
4141
deletedBy: getUserQueryArgs(organizationId),
42-
requestedReviewers: getUserQueryArgs(organizationId)
42+
requestedReviewers: getUserQueryArgs(organizationId),
43+
leadershipChangeRequest: {
44+
include: { lead: getUserQueryArgs(organizationId), manager: getUserQueryArgs(organizationId) }
45+
}
4346
}
4447
});
4548

@@ -58,7 +61,10 @@ export const getManyChangeRequestQueryArgs = (organizationId: string) =>
5861
},
5962
budgetChangeRequest: true,
6063
deletedBy: getUserQueryArgs(organizationId),
61-
requestedReviewers: getUserQueryArgs(organizationId)
64+
requestedReviewers: getUserQueryArgs(organizationId),
65+
leadershipChangeRequest: {
66+
include: { lead: getUserQueryArgs(organizationId), manager: getUserQueryArgs(organizationId) }
67+
}
6268
}
6369
});
6470

@@ -101,6 +107,9 @@ export const getChangeRequestWithProjectAndWorkPackageQueryArgs = (organizationI
101107
},
102108
budgetChangeRequest: true,
103109
deletedBy: getUserQueryArgs(organizationId),
104-
requestedReviewers: getUserQueryArgs(organizationId)
110+
requestedReviewers: getUserQueryArgs(organizationId),
111+
leadershipChangeRequest: {
112+
include: { lead: getUserQueryArgs(organizationId), manager: getUserQueryArgs(organizationId) }
113+
}
105114
}
106115
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-- AlterEnum
2+
ALTER TYPE "CR_Type" ADD VALUE 'LEADERSHIP';
3+
4+
-- CreateTable
5+
CREATE TABLE "Leadership_CR" (
6+
"leadershipCrId" TEXT NOT NULL,
7+
"changeRequestId" TEXT NOT NULL,
8+
"leadId" TEXT,
9+
"managerId" TEXT,
10+
11+
CONSTRAINT "Leadership_CR_pkey" PRIMARY KEY ("leadershipCrId")
12+
);
13+
14+
-- CreateIndex
15+
CREATE UNIQUE INDEX "Leadership_CR_changeRequestId_key" ON "Leadership_CR"("changeRequestId");
16+
17+
-- CreateIndex
18+
CREATE INDEX "Leadership_CR_changeRequestId_idx" ON "Leadership_CR"("changeRequestId");
19+
20+
-- AddForeignKey
21+
ALTER TABLE "Leadership_CR" ADD CONSTRAINT "Leadership_CR_changeRequestId_fkey" FOREIGN KEY ("changeRequestId") REFERENCES "Change_Request"("crId") ON DELETE RESTRICT ON UPDATE CASCADE;
22+
23+
-- AddForeignKey
24+
ALTER TABLE "Leadership_CR" ADD CONSTRAINT "Leadership_CR_leadId_fkey" FOREIGN KEY ("leadId") REFERENCES "User"("userId") ON DELETE SET NULL ON UPDATE CASCADE;
25+
26+
-- AddForeignKey
27+
ALTER TABLE "Leadership_CR" ADD CONSTRAINT "Leadership_CR_managerId_fkey" FOREIGN KEY ("managerId") REFERENCES "User"("userId") ON DELETE SET NULL ON UPDATE CASCADE;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `applyInterestImageId` on the `Organization` table. All the data in the column will be lost.
5+
- You are about to drop the column `exploreAsGuestImageId` on the `Organization` table. All the data in the column will be lost.
6+
7+
*/
8+
-- DropForeignKey
9+
ALTER TABLE "Sponsor" DROP CONSTRAINT "Sponsor_sponsorTierId_fkey";
10+
11+
-- AlterTable
12+
ALTER TABLE "Link_Type" ADD COLUMN "isOnGuestHomePage" BOOLEAN NOT NULL DEFAULT false;
13+
14+
-- AlterTable
15+
ALTER TABLE "Organization" DROP COLUMN "applyInterestImageId",
16+
DROP COLUMN "exploreAsGuestImageId",
17+
ADD COLUMN "platformDescription" TEXT NOT NULL DEFAULT '',
18+
ADD COLUMN "platformLogoImageId" TEXT;
19+
20+
-- AlterTable
21+
ALTER TABLE "Sponsor" ALTER COLUMN "valueTypes" DROP DEFAULT;
22+
23+
-- AddForeignKey
24+
ALTER TABLE "Sponsor" ADD CONSTRAINT "Sponsor_sponsorTierId_fkey" FOREIGN KEY ("sponsorTierId") REFERENCES "Sponsor_Tier"("sponsorTierId") ON DELETE SET NULL 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 "Reimbursement_Request" ADD COLUMN "description" TEXT NOT NULL DEFAULT '';

0 commit comments

Comments
 (0)