Skip to content

Commit

Permalink
Merge pull request #52 from Xitija/main2
Browse files Browse the repository at this point in the history
PS-2664 Swagger documentation for event service
  • Loading branch information
snehal0904 authored Dec 6, 2024
2 parents 8a0af0d + 19bca24 commit 5abd552
Show file tree
Hide file tree
Showing 8 changed files with 2,250 additions and 1,231 deletions.
2,795 changes: 1,596 additions & 1,199 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/common/utils/constants.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ export const ERROR_MESSAGES = {
RECURRENCE_PERIOD_INSUFFICIENT: 'Event recurrence period insufficient',
PUBLIC_EVENTS: 'Public events not implemented!',
DAILY_FREQUENCY: 'Daily frequency is not implemented yet',
END_CONDITION_BY_OCCURENCES:
END_CONDITION_BY_OCCURRENCES:
'End condition by occurrences is not implemented yet',
EVENT_TYPE_CHANGE_NOT_SUPPORTED: 'Event type change not supported',
USERID_INVALID: 'Invalid UserId',
USERID_REQUIRED: 'UserId Required',
PROVIDE_ONE_USERID_IN_QUERY: 'Please provide userId in query params',
API_REQ_FAILURE: (url: string) => `Error occurred on API Request: ${url}`,
DB_QUERY_FAILURE: (url: string) => `Database Query Failed on API: ${url}`,
Expand Down
4 changes: 2 additions & 2 deletions src/common/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type RepetitionDetail = {
id: string;
url: string;
password: string;
occurenceId: string;
occurrenceId: string;
providerGenerated: boolean;
}
| {}
Expand All @@ -45,7 +45,7 @@ export type MeetingDetails = {
url: string;
password: string;
providerGenerated: boolean;
occurenceId: string;
occurrenceId: string;
};

export enum DaysOfWeek {
Expand Down
341 changes: 341 additions & 0 deletions src/modules/event/dto/create-event-example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,341 @@
const createEventsExamples: Record<
string,
{
title: string;
shortDescription: string;
description: string;
eventType: string;
isRestricted: boolean;
autoEnroll: boolean;
startDatetime: string;
endDatetime: string;
location?: string;
latitude?: string;
longitude?: string;
onlineProvider?: string;
isMeetingNew?: boolean;
meetingDetails?: any;
maxAttendees?: any;
attendees?: any[];
recordings?: any;
status: string;
idealTime?: string;
registrationStartDate?: string;
registrationEndDate?: string;
isRecurring: boolean;
recurrencePattern?: any;
metaData?: any;
erMetaData?: any;
}
> = {
RecurringOnlineDailyByEndDate: {
title: 'Sample OnlineDailyByEndDate Event',
shortDescription: 'This is a sample event',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
eventType: 'online',
isRestricted: true,
autoEnroll: true,
startDatetime: '2024-12-18T10:00:00Z',
endDatetime: '2024-12-18T11:00:00Z',
onlineProvider: 'Zoom',
isMeetingNew: false,
meetingDetails: {
url: 'https://zoom.us/j/99201586505?pwd=ZA8uek6tYu0LQTPbW2GgIORpNDmv7j',
id: 'meeting-id',
},
attendees: [],
recordings: {
url: 'https://zoom.com/recording',
},
status: 'live',
isRecurring: true,
recurrencePattern: {
frequency: 'daily',
interval: 1,
endCondition: {
type: 'endDate',
value: '2024-12-25T11:00:00Z',
},
recurringStartDate: '2024-03-18T10:00:00Z',
},
metaData: { cohortId: '3218bb35-a87d-4adf-b305-b205286fe320' },
erMetaData: {},
},
RecurringOnlineDailyByOccurrences: {
title: 'Sample OnlineDailyByOccurrences Event',
shortDescription: 'This is a sample event',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
eventType: 'online',
isRestricted: true,
autoEnroll: true,
startDatetime: '2024-12-18T10:00:00Z',
endDatetime: '2024-12-18T11:00:00Z',
onlineProvider: 'Zoom',
isMeetingNew: false,
meetingDetails: {
url: 'https://zoom.us/j/99201586505?pwd=ZA8uek6tYu0LQTPbW2GgIORpNDmv7j',
id: 'meeting-id',
},
attendees: [],
recordings: {
url: 'https://zoom.com/recording',
},
status: 'live',
isRecurring: true,
recurrencePattern: {
frequency: 'daily',
interval: 1,
endCondition: {
type: 'occurrences',
value: '20',
},
recurringStartDate: '2024-03-18T10:00:00Z',
},
metaData: { cohortId: '3218bb35-a87d-4adf-b305-b205286fe320' },
erMetaData: {},
},
RecurringOfflineDailyByEndDate: {
title: 'Sample OfflineDailyByEndDate Event',
shortDescription: 'This is a sample event',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
eventType: 'offline',
isRestricted: true,
autoEnroll: true,
startDatetime: '2024-12-18T10:00:00Z',
endDatetime: '2024-12-18T11:00:00Z',
location: 'Kothrud',
// "maxAttendees": 100,
attendees: [],
recordings: {
url: 'https://zoom.com/recording',
},
status: 'live',
isRecurring: true,
recurrencePattern: {
frequency: 'daily',
interval: 1,
endCondition: {
type: 'endDate',
value: '2024-12-25T11:00:00Z',
},
recurringStartDate: '2024-03-18T10:00:00Z',
},
metaData: {
cohortId: '3218bb35-a87d-4adf-b305-b205286fe320',
},
erMetaData: {},
},
RecurringOfflineDailyByOccurrence: {
title: 'Sample OfflineDailyByOccurrence Event',
shortDescription: 'This is a sample event',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
eventType: 'offline',
isRestricted: true,
autoEnroll: true,
startDatetime: '2024-12-18T10:00:00Z',
endDatetime: '2024-12-18T11:00:00Z',
location: 'Kothrud',
attendees: [],
recordings: {
url: 'https://zoom.com/recording',
},
status: 'live',
isRecurring: true,
recurrencePattern: {
frequency: 'daily',
interval: 1,
endCondition: {
type: 'occurrences',
value: '20',
},
recurringStartDate: '2024-03-18T10:00:00Z',
},
metaData: {
cohortId: '3218bb35-a87d-4adf-b305-b205286fe320',
},
erMetaData: {},
},
RecurringOnlineWeeklyByEndDate: {
title: 'Sample OnlineWeeklyByEndDate Event',
shortDescription: 'This is a sample event',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
eventType: 'online',
isRestricted: true,
autoEnroll: true,
startDatetime: '2024-12-18T10:00:00Z',
endDatetime: '2024-12-18T11:00:00Z',
onlineProvider: 'Zoom',
isMeetingNew: false,
meetingDetails: {
url: 'https://zoom.us/j/99201586505?pwd=ZA8uek6tYu0LQTPbW2GgIORpNDmv7j',
id: 'meeting-id',
},
attendees: [],
recordings: {
url: 'https://example.com/recording',
},
status: 'live',
isRecurring: true,
recurrencePattern: {
frequency: 'weekly',
interval: 1,
daysOfWeek: [3, 5], // Wednesday ,friday
endCondition: {
type: 'endDate',
value: '2024-12-25T11:00:00Z',
},
recurringStartDate: '2024-12-18T10:00:00Z',
},
metaData: {},
erMetaData: {},
},
RecurringOnlineWeeklyByOccurrences: {
title: 'Sample OnlineWeeklyByOccurrences Event',
shortDescription: 'This is a sample event',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
eventType: 'online',
isRestricted: true,
autoEnroll: true,
startDatetime: '2024-12-18T10:00:00Z',
endDatetime: '2024-12-18T11:00:00Z',
onlineProvider: 'Zoom',
isMeetingNew: false,
meetingDetails: {
url: 'https://zoom.us/j/99201586505?pwd=ZA8uek6tYu0LQTPbW2GgIORpNDmv7j',
id: 'meeting-id',
},
attendees: [],
recordings: {
url: 'https://example.com/recording',
},
status: 'live',
isRecurring: true,
recurrencePattern: {
frequency: 'weekly',
interval: 1,
daysOfWeek: [3, 5], // Wednesday ,friday
endCondition: {
type: 'occurrences',
value: '20',
},
recurringStartDate: '2024-12-18T10:00:00Z',
},
metaData: {},
erMetaData: {},
},
RecurringOfflineWeeklyByEndDate: {
title: 'Sample Event',
shortDescription: 'This is a sample event',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
eventType: 'offline',
isRestricted: true,
autoEnroll: true,
startDatetime: '2024-12-18T10:00:00Z',
endDatetime: '2024-12-18T11:00:00Z',
location: 'Kothrud',
attendees: [],
recordings: {
url: 'https://example.com/recording',
},
status: 'live',
isRecurring: true,
recurrencePattern: {
frequency: 'weekly',
interval: 1,
daysOfWeek: [3, 5], // Wednesday ,friday
endCondition: {
type: 'endDate',
value: '2024-12-25T11:00:00Z',
},
recurringStartDate: '2024-12-18T10:00:00Z',
},
metaData: {},
erMetaData: {},
},
RecurringOfflineWeeklyByOccurrence: {
title: 'Sample Event',
shortDescription: 'This is a sample event',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
eventType: 'offline',
isRestricted: true,
autoEnroll: true,
startDatetime: '2024-12-18T10:00:00Z',
endDatetime: '2024-12-18T11:00:00Z',
location: 'Kothrud',
attendees: [],
recordings: {
url: 'https://example.com/recording',
},
status: 'live',
isRecurring: true,
recurrencePattern: {
frequency: 'weekly',
interval: 1,
daysOfWeek: [3, 5], // Wednesday ,friday
endCondition: {
type: 'occurrences',
value: '20',
},
recurringStartDate: '2024-12-18T10:00:00Z',
},
metaData: {},
erMetaData: {},
},
NonRecurringOffline: {
title: 'Sample Event',
shortDescription: 'This is a sample event',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
eventType: 'offline',
isRestricted: true,
autoEnroll: true,
startDatetime: '2024-12-18T10:00:00Z',
endDatetime: '2024-12-18T11:00:00Z',
location: 'Kothrud',
attendees: [],
recordings: {
url: 'https://example.com/recording',
},
status: 'live',
isRecurring: false,
metaData: {},
erMetaData: {},
},
NonRecurringOnline: {
title: 'Sample NonRecurringOnline Event',
shortDescription: 'This is a sample event',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
eventType: 'online',
isRestricted: true,
autoEnroll: true,
startDatetime: '2024-12-18T10:00:00Z',
endDatetime: '2024-12-18T11:00:00Z',
onlineProvider: 'Zoom',
isMeetingNew: false,
meetingDetails: {
url: 'https://zoom.us/j/99201586505?pwd=ZA8uek6tYu0LQTPbW2GgIORpNDmv7j',
id: 'meeting-id',
},
attendees: [],
recordings: {
url: 'https://example.com/recording',
},
status: 'live',
isRecurring: false,
metaData: {},
erMetaData: {},
},
};

export const createEventsExamplesForSwagger = Object.entries(
createEventsExamples,
).reduce(
(acc, [key, value]) => {
acc[key] = {
summary: `Example for ${key}`,
description: `Detailed example for ${key}`,
value, // Use the example value as-is
};
return acc;
},
{} as Record<string, { summary: string; description: string; value: any }>,
);
Loading

0 comments on commit 5abd552

Please sign in to comment.