Skip to content

Commit 7266798

Browse files
committed
misc calendar changes
1 parent e2edc28 commit 7266798

40 files changed

Lines changed: 240 additions & 1304 deletions

src/backend/src/services/calendar.services.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,8 @@ export default class CalendarService {
464464
...getEventQueryArgs(organization.organizationId)
465465
});
466466

467+
const createdEvent = eventTransformer(newEvent);
468+
467469
let calendarEventIds: string[] = [];
468470
if (process.env.NODE_ENV === 'production') {
469471
try {
@@ -514,14 +516,12 @@ export default class CalendarService {
514516
if (memberUserSetting.slackId) {
515517
try {
516518
// For each project associated with this event
517-
for (const project of projects) {
518-
await sendSlackEventConfirmNotification(
519-
memberUserSetting.slackId,
520-
newEvent.eventId,
521-
newEvent.title,
522-
project.wbsElement.name
523-
);
524-
}
519+
await sendSlackEventConfirmNotification(
520+
memberUserSetting.slackId,
521+
newEvent.eventId,
522+
newEvent.title,
523+
projects.map((project) => project.wbsElement.name).join(', ')
524+
);
525525
} catch (err: unknown) {
526526
if (err instanceof Error) {
527527
throw new HttpException(500, `Failed to send slack notification: ${err.message}`);
@@ -534,8 +534,6 @@ export default class CalendarService {
534534
// Send popup notification
535535
await sendEventPopUp(newEvent, members, submitter, workPackageNames, organization.organizationId);
536536

537-
const createdEvent = eventTransformer(newEvent);
538-
539537
for (const project of projects) {
540538
const projectTeams = project.teams;
541539
if (projectTeams.length > 0) {
@@ -548,10 +546,9 @@ export default class CalendarService {
548546
);
549547
}
550548
}
551-
return createdEvent;
552549
}
553550

554-
return eventTransformer(newEvent);
551+
return createdEvent;
555552
}
556553

557554
/**
@@ -616,12 +613,11 @@ export default class CalendarService {
616613
if (!foundEventType) throw new NotFoundException('Event Type', eventTypeId);
617614
if (foundEventType.dateDeleted) throw new DeletedException('Event Type', eventTypeId);
618615

619-
// Note: Schedule validation is removed since editEvent doesn't modify schedules
620-
// Use editScheduleSlot to modify individual schedule slots
616+
// NOTE: Use editScheduleSlot to modify individual schedule slots
621617

622618
// question document is required if the status is scheduled or done
623619
if (foundEventType.requiresConfirmation) {
624-
if (foundEvent.status === Event_Status.SCHEDULED || foundEvent.status === Event_Status.DONE) {
620+
if (status === Event_Status.SCHEDULED || status === Event_Status.DONE) {
625621
if (questionDocumentLink == null) {
626622
throw new HttpException(400, 'doc template link is required for scheduled and done design reviews');
627623
}

0 commit comments

Comments
 (0)