Scheduling infrastructure for absolutely everyone.
feat: add response status to calendar event host details (#21934)
Somay Chauhan795fd788e226
diff --git a/apps/api/v2/src/modules/cal-unified-calendars/outputs/get-unified-calendar-event.ts b/apps/api/v2/src/modules/cal-unified-calendars/outputs/get-unified-calendar-event.tsindex a5846a08da7..273cbcb76e7 100644--- a/apps/api/v2/src/modules/cal-unified-calendars/outputs/get-unified-calendar-event.ts+++ b/apps/api/v2/src/modules/cal-unified-calendars/outputs/get-unified-calendar-event.ts@@ -211,6 +211,18 @@ export class CalendarEventHost {description: "Display name of the event host",})name?: string;++ @IsString()+ @IsOptional()+ @IsEnum(CalendarEventResponseStatus)+ @ApiPropertyOptional({+ enum: CalendarEventResponseStatus,+ nullable: true,+ enumName: "CalendarEventResponseStatus",+ description: "Host's response to the invitation",+ example: CalendarEventResponseStatus.ACCEPTED,+ })+ responseStatus!: CalendarEventResponseStatus | null;}export class CalendarEventAttendee {diff --git a/apps/api/v2/src/modules/cal-unified-calendars/pipes/get-calendar-event-details-output-pipe.ts b/apps/api/v2/src/modules/cal-unified-calendars/pipes/get-calendar-event-details-output-pipe.tsindex 3bdddcfb667..906dcc8b3d0 100644--- a/apps/api/v2/src/modules/cal-unified-calendars/pipes/get-calendar-event-details-output-pipe.ts+++ b/apps/api/v2/src/modules/cal-unified-calendars/pipes/get-calendar-event-details-output-pipe.ts@@ -159,28 +159,28 @@ export class GoogleCalendarEventOutputPipe}}- private transformHosts(googleEvent: GoogleCalendarEventResponse): Array<{ email: string; name?: string }> {- if (googleEvent.organizer) {- return [- {- email: googleEvent.organizer.email,- name: googleEvent.organizer.displayName,- },- ];- } else if (googleEvent.attendees) {- // If no explicit organizer, find the first attendee with organizer flag- const organizerAttendee = googleEvent.attendees.find((attendee) => attendee.organizer);- if (organizerAttendee) {- return [- {- email: organizerAttendee.email,- name: organizerAttendee.displayName,- },- ];- }+ private transformHosts(googleEvent: GoogleCalendarEventResponse) {+ const hosts: Array<{ email: string; name?: string; responseStatus: CalendarEventResponseStatus | null }> =+ [];++ const organizerAttendees = googleEvent?.attendees?.filter((attendee) => attendee.organizer);+ if (organizerAttendees?.length) {+ organizerAttendees.forEach((organizer) => {+ hosts.push({+ email: organizer.email,+ name: organizer.displayName,+ responseStatus: this.transformAttendeeResponseStatus(organizer.responseStatus),+ });+ });+ } else {+ hosts.push({+ email: googleEvent.organizer.email,+ name: googleEvent.organizer.displayName,+ responseStatus: null,+ });}- return [];+ return hosts;}private transformLocations(diff --git a/apps/api/v2/swagger/documentation.json b/apps/api/v2/swagger/documentation.jsonindex ea2ed740b6a..995193fcbd9 100644--- a/apps/api/v2/swagger/documentation.json+++ b/apps/api/v2/swagger/documentation.json@@ -26400,7 +26400,7 @@},"CalendarEventResponseStatus": {"type": "string",- "description": "Attendee's response to the invitation",+ "description": "Host's response to the invitation","enum": ["accepted","pending",@@ -26460,6 +26460,11 @@"type": "string","nullable": true,"description": "Display name of the event host"+ },+ "responseStatus": {+ "nullable": true,+ "example": "accepted",+ "$ref": "#/components/schemas/CalendarEventResponseStatus"}},"required": [diff --git a/docs/api-reference/v2/openapi.json b/docs/api-reference/v2/openapi.jsonindex 89e56c494c5..80418c4e064 100644--- a/docs/api-reference/v2/openapi.json+++ b/docs/api-reference/v2/openapi.json@@ -24102,7 +24102,7 @@},"CalendarEventResponseStatus": {"type": "string",- "description": "Attendee's response to the invitation",+ "description": "Host's response to the invitation","enum": ["accepted", "pending", "declined", "needsAction"]},"CalendarEventAttendee": {@@ -24150,6 +24150,11 @@"type": "string","nullable": true,"description": "Display name of the event host"+ },+ "responseStatus": {+ "nullable": true,+ "example": "accepted",+ "$ref": "#/components/schemas/CalendarEventResponseStatus"}},"required": ["email"]