From 61a68eb87abed6e005177a78f19e7a3a536a75cb Mon Sep 17 00:00:00 2001 From: Natasha Date: Thu, 2 Apr 2026 19:14:30 -0400 Subject: [PATCH 1/4] #4039-NatashaJoshi-credits --- src/frontend/src/pages/CalendarPage/Components/EventModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/pages/CalendarPage/Components/EventModal.tsx b/src/frontend/src/pages/CalendarPage/Components/EventModal.tsx index b84d5360ad..c60f168b35 100644 --- a/src/frontend/src/pages/CalendarPage/Components/EventModal.tsx +++ b/src/frontend/src/pages/CalendarPage/Components/EventModal.tsx @@ -115,7 +115,7 @@ export interface EventPayload { } const schema = yup.object().shape({ - title: yup.string().required('Title is required'), + title: yup.string().required('Title is required').matches(/^\S*$/, 'Whitespace is not allowed'), eventTypeId: yup.string().required('Event Type is required'), requiredMemberIds: yup.array().of(yup.string().required()).default([]), optionalMemberIds: yup.array().of(yup.string().required()).default([]), From 3d39e77bb530c4a28618111f5ada548c0cf18705 Mon Sep 17 00:00:00 2001 From: Sarah Taylor <150694563+staysgt@users.noreply.github.com> Date: Mon, 25 May 2026 13:41:47 -0400 Subject: [PATCH 2/4] #3995 blank dr title --- src/frontend/src/pages/CalendarPage/Components/EventModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/pages/CalendarPage/Components/EventModal.tsx b/src/frontend/src/pages/CalendarPage/Components/EventModal.tsx index c60f168b35..ba9c0da235 100644 --- a/src/frontend/src/pages/CalendarPage/Components/EventModal.tsx +++ b/src/frontend/src/pages/CalendarPage/Components/EventModal.tsx @@ -115,7 +115,7 @@ export interface EventPayload { } const schema = yup.object().shape({ - title: yup.string().required('Title is required').matches(/^\S*$/, 'Whitespace is not allowed'), + title: yup.string().required('Title is required').trim().min(1, 'Title cannot be only whitespace'), eventTypeId: yup.string().required('Event Type is required'), requiredMemberIds: yup.array().of(yup.string().required()).default([]), optionalMemberIds: yup.array().of(yup.string().required()).default([]), From 70e473a67f6afc771d9c16b82b23f44cc1d63427 Mon Sep 17 00:00:00 2001 From: Sarah Taylor <150694563+staysgt@users.noreply.github.com> Date: Tue, 26 May 2026 16:15:53 -0400 Subject: [PATCH 3/4] #4039 check title whitespace backend --- src/backend/src/services/calendar.services.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/src/services/calendar.services.ts b/src/backend/src/services/calendar.services.ts index 7aa1033af7..e7c855955a 100644 --- a/src/backend/src/services/calendar.services.ts +++ b/src/backend/src/services/calendar.services.ts @@ -271,6 +271,8 @@ export default class CalendarService { zoomLink?: string, description?: string ): Promise { + if (!title.trim()) throw new HttpException(400, 'Title cannot be only whitespace'); + // Validate eventTypeId const foundEventType = await prisma.event_Type.findUnique({ where: { eventTypeId } @@ -592,6 +594,8 @@ export default class CalendarService { zoomLink?: string, description?: string ): Promise { + if (!title.trim()) throw new HttpException(400, 'Title cannot be only whitespace'); + // validate eventId const foundEvent = await prisma.event.findUnique({ where: { eventId }, From 9d1fc6f7e6868795527109769936e23ca2106aff Mon Sep 17 00:00:00 2001 From: Sarah Taylor <150694563+staysgt@users.noreply.github.com> Date: Tue, 26 May 2026 20:28:23 -0400 Subject: [PATCH 4/4] #4039 move logic to validation util --- src/backend/src/services/calendar.services.ts | 4 ---- src/backend/src/utils/validation.utils.ts | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/backend/src/services/calendar.services.ts b/src/backend/src/services/calendar.services.ts index e7c855955a..7aa1033af7 100644 --- a/src/backend/src/services/calendar.services.ts +++ b/src/backend/src/services/calendar.services.ts @@ -271,8 +271,6 @@ export default class CalendarService { zoomLink?: string, description?: string ): Promise { - if (!title.trim()) throw new HttpException(400, 'Title cannot be only whitespace'); - // Validate eventTypeId const foundEventType = await prisma.event_Type.findUnique({ where: { eventTypeId } @@ -594,8 +592,6 @@ export default class CalendarService { zoomLink?: string, description?: string ): Promise { - if (!title.trim()) throw new HttpException(400, 'Title cannot be only whitespace'); - // validate eventId const foundEvent = await prisma.event.findUnique({ where: { eventId }, diff --git a/src/backend/src/utils/validation.utils.ts b/src/backend/src/utils/validation.utils.ts index c39e23cc24..6ed8afa96f 100644 --- a/src/backend/src/utils/validation.utils.ts +++ b/src/backend/src/utils/validation.utils.ts @@ -23,9 +23,8 @@ export const decimalMinZero = (validationObject: ValidationChain): ValidationCha .withMessage('Value must be greater than or equal to zero'); }; -//Const to return if an input is a string and is not empty export const nonEmptyString = (validationObject: ValidationChain): ValidationChain => { - return validationObject.isString().not().isEmpty(); + return validationObject.isString().not().isEmpty({ ignore_whitespace: true }); }; export const isRole = (validationObject: ValidationChain): ValidationChain => {