-
Notifications
You must be signed in to change notification settings - Fork 71
refactor(calendar): extract validation logic into a separate layer #313
Copy link
Copy link
Open
Description
Context
From PR #308 review feedback by @abhipatel12:
The validations here make sense. At some point it may make sense to have a validation layer to separate all this logic to make it easier to read.
Problem
CalendarService.createEvent and updateEvent have accumulated significant inline validation logic:
- start/end dateTime vs date exclusivity checks
- eventType-specific constraints (focusTime/outOfOffice can't be all-day)
- workingLocationProperties required sub-property validation
- summary requirements based on eventType
- ISO 8601 datetime format validation
- Email format validation
This makes the methods harder to read and the validation harder to reuse or test independently.
Proposal
Extract calendar event validation into a dedicated module (e.g. CalendarValidation.ts) that:
- Consolidates all input validation for
createEventandupdateEvent - Returns structured validation errors
- Can be unit tested independently of the service
- Keeps the service methods focused on API interaction logic
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels