Skip to content

Commit 1cc8ded

Browse files
committed
Merge branch 'feature/gantt-chart-improvements' into #3845-mouse-placement-bug
2 parents 4e54485 + 380e59e commit 1cc8ded

50 files changed

Lines changed: 1001 additions & 984 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/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/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
});
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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `reimbursementRequestId` on the `Material` table. All the data in the column will be lost.
5+
6+
*/
7+
-- DropForeignKey
8+
ALTER TABLE "Material" DROP CONSTRAINT "Material_reimbursementRequestId_fkey";
9+
10+
-- DropIndex
11+
DROP INDEX "Material_reimbursementRequestId_idx";
12+
13+
-- AlterTable
14+
ALTER TABLE "Material" DROP COLUMN "reimbursementRequestId";

src/backend/src/prisma/schema.prisma

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -599,16 +599,17 @@ model Work_Package {
599599
}
600600

601601
model Link_Type {
602-
id String @id @default(uuid())
603-
name String
604-
dateCreated DateTime @default(now())
605-
iconName String
606-
required Boolean
607-
creatorId String
608-
creator User @relation(name: "linkTypeCreator", fields: [creatorId], references: [userId])
609-
links Link[] @relation(name: "linkTypes")
610-
organizationId String
611-
organization Organization @relation(fields: [organizationId], references: [organizationId])
602+
id String @id @default(uuid())
603+
name String
604+
dateCreated DateTime @default(now())
605+
iconName String
606+
required Boolean
607+
creatorId String
608+
creator User @relation(name: "linkTypeCreator", fields: [creatorId], references: [userId])
609+
links Link[] @relation(name: "linkTypes")
610+
organizationId String
611+
organization Organization @relation(fields: [organizationId], references: [organizationId])
612+
isOnGuestHomePage Boolean @default(false)
612613
613614
@@unique([name, organizationId], name: "uniqueLinkType")
614615
@@index([organizationId])
@@ -756,7 +757,6 @@ model Reimbursement_Request {
756757
organizationId String
757758
organization Organization @relation(fields: [organizationId], references: [organizationId])
758759
notificationSlackThreads Message_Info[]
759-
materials Material[]
760760
reimbursementComments Reimbursement_Request_Comment[]
761761
assigneeId String?
762762
assignee User? @relation(name: "reimbursementRequestAssignee", fields: [assigneeId], references: [userId])
@@ -1016,14 +1016,11 @@ model Material {
10161016
subtotal Int?
10171017
linkUrl String
10181018
notes String?
1019-
reimbursementRequest Reimbursement_Request? @relation(fields: [reimbursementRequestId], references: [reimbursementRequestId])
1020-
reimbursementRequestId String?
10211019
reimbursementProducts Reimbursement_Product[]
10221020
10231021
@@index([assemblyId])
10241022
@@index([materialTypeId])
10251023
@@index([manufacturerId])
1026-
@@index([reimbursementRequestId])
10271024
@@index([wbsElementId])
10281025
}
10291026

@@ -1396,8 +1393,6 @@ model Organization {
13961393
advisor User? @relation(name: "advisor", fields: [advisorId], references: [userId])
13971394
advisorId String?
13981395
description String @default("")
1399-
applyInterestImageId String?
1400-
exploreAsGuestImageId String?
14011396
newMemberImageId String?
14021397
logoImageId String?
14031398
slackWorkspaceId String?
@@ -1406,6 +1401,8 @@ model Organization {
14061401
partReviewSampleImageId String?
14071402
partReviewGuideLink String?
14081403
sponsorshipNotificationsSlackChannelId String?
1404+
platformDescription String @default("")
1405+
platformLogoImageId String?
14091406
14101407
// Relation references
14111408
wbsElements WBS_Element[]

0 commit comments

Comments
 (0)