Skip to content

Commit cb41273

Browse files
committed
Merge branch 'develop' into multitenancy
2 parents 3873b3e + dcf8df3 commit cb41273

20 files changed

Lines changed: 400 additions & 263 deletions

File tree

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage - compile TypeScript
2-
FROM node:20 AS builder
2+
FROM node:25 AS builder
33
WORKDIR /app
44

55
COPY package.json tsconfig.build.json ./
@@ -11,11 +11,11 @@ RUN cd src/backend && npx prisma generate
1111
RUN yarn build:shared
1212
RUN yarn build:backend
1313

14-
FROM node:20-slim
14+
FROM platformatic/node-caged:25-slim
1515
WORKDIR /app
1616

1717
# Install OpenSSL for Prisma (slim image needs this)
18-
RUN apt-get update -y && apt-get install -y openssl && rm -rf /var/lib/apt/lists/*
18+
RUN apt-get update -y && apt-get install -y openssl && rm -rf /var/lib/apt/lists/* && npm install -g yarn
1919

2020
COPY package.json ./
2121

devContainerization/Dockerfile.backend.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20
1+
FROM node:25
22

33
COPY package.json tsconfig.build.json ./
44
COPY ./src/backend/package.json ./src/backend/tsconfig.json src/backend/

devContainerization/Dockerfile.frontend.dev

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20-alpine
1+
FROM node:25-alpine
22

33
COPY package.json tsconfig.build.json ./
44
COPY ./src/frontend/package.json ./src/frontend/tsconfig.json src/frontend/
@@ -11,4 +11,4 @@ COPY ./src/frontend src/frontend
1111
COPY ./src/shared src/shared
1212

1313
EXPOSE 3000
14-
CMD [ "yarn", "workspace", "frontend", "vite", "--force", "--host" ]
14+
CMD [ "yarn", "workspace", "frontend", "vite", "--force", "--host" ]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"@babel/preset-typescript": "^7.18.6",
8787
"@types/canvas-confetti": "^1.9.0",
8888
"@types/jest": "^29.5.14",
89-
"@types/node": "20.0.0",
89+
"@types/node": "^25.0.0",
9090
"@typescript-eslint/eslint-plugin": "8.20.0",
9191
"@typescript-eslint/parser": "8.20.0",
9292
"concurrently": "^9.1.0",

src/backend/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# TO BE RUN FROM DOCKER COMPOSE. DO NOT RUN MANUALLY AS CONTEXT IS NOT SET CORRECTLY
2-
FROM node:20
2+
FROM platformatic/node-caged:25-slim
3+
RUN npm install -g yarn
34

45
WORKDIR /base
56

src/backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"devDependencies": {
4040
"@types/express-jwt": "^6.0.4",
4141
"@types/jsonwebtoken": "^8.5.9",
42-
"@types/node": "^20.0.0",
42+
"@types/node": "^25.0.0",
4343
"@types/supertest": "^2.0.12",
4444
"nodemon": "^2.0.16",
4545
"supertest": "^6.2.4",

src/backend/src/services/notifications.services.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default class NotificationsService {
118118
}
119119

120120
/**
121-
* Sends the design review slack notifications for all design reviews scheduled for today
121+
* Sends Slack notifications for all events scheduled for today whose event type has sendSlackNotifications enabled
122122
*/
123123
static async sendEventSlackNotifications() {
124124
const endOfToday = startOfDayTomorrow();
@@ -142,6 +142,8 @@ export default class NotificationsService {
142142
optionalMembers: { include: { userSettings: true } },
143143
userCreated: { include: { userSettings: true } },
144144
scheduledTimes: true,
145+
teams: true,
146+
eventType: true,
145147
workPackages: {
146148
include: {
147149
wbsElement: true,
@@ -156,12 +158,18 @@ export default class NotificationsService {
156158
}
157159
});
158160

159-
const desginReviewEventTeamMap = new Map<string, EventWithAttendees[]>();
161+
const eventTeamMap = new Map<string, EventWithAttendees[]>();
160162

161163
events.forEach((event) => {
162-
// Get all unique teams from all work packages associated with this event
164+
// Collect unique team Slack IDs: first from teams directly on the event, then from work packages
163165
const teamSlackIds = new Set<string>();
164166

167+
event.teams.forEach((team) => {
168+
if (team.slackId) {
169+
teamSlackIds.add(team.slackId);
170+
}
171+
});
172+
165173
event.workPackages.forEach((workPackage) => {
166174
workPackage.project.teams.forEach((team) => {
167175
if (team.slackId) {
@@ -171,7 +179,7 @@ export default class NotificationsService {
171179
});
172180

173181
teamSlackIds.forEach((teamSlackId) => {
174-
const currentEvents = desginReviewEventTeamMap.get(teamSlackId);
182+
const currentEvents = eventTeamMap.get(teamSlackId);
175183
const eventWithAttendees = {
176184
...event,
177185
attendees: event.requiredMembers.concat(event.optionalMembers).concat(event.userCreated),
@@ -181,20 +189,20 @@ export default class NotificationsService {
181189
if (currentEvents) {
182190
currentEvents.push(eventWithAttendees);
183191
} else {
184-
desginReviewEventTeamMap.set(teamSlackId, [eventWithAttendees]);
192+
eventTeamMap.set(teamSlackId, [eventWithAttendees]);
185193
}
186194
});
187195
});
188196

189-
// Send the notifications to each team for their respective design reviews
190-
const promises = Array.from(desginReviewEventTeamMap).map(async ([slackId, events]) => {
197+
// Send the notifications to each team for their respective events
198+
const promises = Array.from(eventTeamMap).map(async ([slackId, events]) => {
191199
const messageBlock = events
192200
.map((event) => {
193201
const zoomLink = event.zoomLink ? `<${event.zoomLink}|Zoom Link>\n` : '';
194202
const questionDocLink = event.questionDocumentLink ? `<${event.questionDocumentLink}|Question Doc Link>\n` : '';
195203

196-
// Get work package names for this event
197204
const workPackageNames = event.workPackages.map((wp) => wp.wbsElement.name).join(', ');
205+
const workPackagesPart = workPackageNames ? ` (${workPackageNames})` : '';
198206

199207
// Get the earliest scheduled start time for display
200208
const [earliestSlot] = event.scheduledTimes
@@ -203,17 +211,17 @@ export default class NotificationsService {
203211
const timeDisplay = earliestSlot ? formatTimeForSlack(new Date(earliestSlot.startTime!)) : 'TBD';
204212

205213
return (
206-
`${usersToSlackPings(event.attendees ?? [])} ${event.title} (${workPackageNames}) ` +
214+
`${usersToSlackPings(event.attendees ?? [])} *${event.eventType.name}*: ${event.title}${workPackagesPart} ` +
207215
`will be having an event today at ${timeDisplay} ET! ` +
208216
zoomLink +
209217
questionDocLink
210218
);
211219
})
212220
.join('\n\n');
213221

214-
// messageBlock will be empty if there are design reviews with no attendees
222+
// messageBlock will be empty if there are events with no attendees
215223
if (messageBlock !== '')
216-
await sendMessage(slackId, ':calendar: :clock9: Upcoming Design Reviews! :clock9: :calendar: \n\n\n' + messageBlock);
224+
await sendMessage(slackId, ':calendar: :clock9: Upcoming Events! :clock9: :calendar: \n\n\n' + messageBlock);
217225
});
218226

219227
await Promise.all(promises);

src/backend/src/utils/notifications.utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Task as Prisma_Task, WBS_Element, Event, Work_Package } from '@prisma/client';
1+
import { Task as Prisma_Task, WBS_Element, Event, Work_Package, Team, Event_Type } from '@prisma/client';
22
import { UserWithSettings } from './auth.utils.js';
33
import { ScheduleSlot } from 'shared';
44

@@ -10,6 +10,8 @@ export type TaskWithAssignees = Prisma_Task & {
1010
export type EventWithAttendees = Event & {
1111
attendees: UserWithSettings[];
1212
scheduledTimes: ScheduleSlot[];
13+
teams: Team[];
14+
eventType: Event_Type;
1315
workPackages: (Work_Package & {
1416
wbsElement: WBS_Element;
1517
})[];

src/docs-site/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ If your changes aren't appearing:
246246

247247
Common issues:
248248

249-
- **Node version**: Ensure you're running Node.js 18 or higher
249+
- **Node version**: Ensure you're running Node.js 18 or higher (although you should be running node 25 for the main site development)
250250
- **Dependencies**: From the root directory, try `rm -rf docs-site/node_modules && yarn install`
251251
- **Port conflict**: Docs run on port 3002. If it's in use, Docusaurus will try another port or you can stop the conflicting process
252252

src/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"@testing-library/react": "^16.2.0",
5959
"@testing-library/react-hooks": "^8.0.1",
6060
"@testing-library/user-event": "^14.6.0",
61-
"@types/node": "20.0.0",
61+
"@types/node": "^25.0.0",
6262
"@types/react": "^19.0.7",
6363
"@types/react-dom": "^19.0.3",
6464
"@types/react-helmet": "^6.1.6",

0 commit comments

Comments
 (0)