Skip to content

Commit

Permalink
chore : string constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Xitija committed Sep 23, 2024
1 parent c371899 commit f43aa56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/common/utils/constants.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export const ERROR_MESSAGES = {
CANNOT_PREPONE_PAST_EVENTS:
'Cannot update events prepone not allowed for past events',
CANNOT_EDIT_ARCHIVED_EVENTS: 'Cannot Edit archived events',
ENDTIME_DOES_NOT_MATCH:
'Event End time does not match with Recurrence Start or End time',
PROVIDE_VALID_START_AND_END_DATETIME:
'Please Provide Valid Start and End Date',
RECURRENCE_PATTERN_MISSING: 'Recurring Pattern is missing for this event',
CANNOT_PASS_MAIN_EVENT_FALSE:
'You can not pass isMainEvent false because event is non recurring',
CREATION_LIMIT_UNAVAILABLE: 'Event creation limit unavailable',
Expand Down
10 changes: 5 additions & 5 deletions src/modules/event/event.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,7 @@ export class EventService {

checkValidRecurrenceTimeForUpdate(endDate, recurrenceEndDate) {
if (endDate.split('T')[1] !== recurrenceEndDate.split('T')[1]) {
throw new BadRequestException(
'Event End time does not match with Recurrence Start or End time',
);
throw new BadRequestException(ERROR_MESSAGES.ENDTIME_DOES_NOT_MATCH);
}
}

Expand Down Expand Up @@ -805,15 +803,17 @@ export class EventService {
updateBody.recurrencePattern &&
event.isRecurring
) {
throw new BadRequestException('Please Provide Valid Start and End Date');
throw new BadRequestException(
ERROR_MESSAGES.PROVIDE_VALID_START_AND_END_DATETIME,
);
}

// Handle recurring events
if (startDatetime && endDatetime && event.isRecurring) {
// check if rec is passed
if (!updateBody.recurrencePattern) {
throw new BadRequestException(
'Recurring Pattern is missing for this event',
ERROR_MESSAGES.RECURRENCE_PATTERN_MISSING,
);
}

Expand Down

0 comments on commit f43aa56

Please sign in to comment.