Calendar event fixes and improvements (#4690)

* fixes

* saving workspaceMemberId and personId when saving attendees

* add typing

* use Map

* improve saveMessageParticipants

* fix role type

* move logic in a service

* create new service

* use new service in calendar-event-attendee.service

* modify service to include more common logic

* add defaumt value to isOrganizer in calendar-event-attendee.object-metadata

* rename folder

* renaming
This commit is contained in:
bosiraphael
2024-03-29 10:03:00 +01:00
committed by GitHub
parent 1829f4d009
commit 68977dc675
15 changed files with 217 additions and 112 deletions

View File

@ -78,38 +78,6 @@ export class CalendarEventAttendeeRepository {
);
}
public async saveCalendarEventAttendees(
calendarEventAttendees: CalendarEventAttendee[],
workspaceId: string,
transactionManager?: EntityManager,
): Promise<void> {
if (calendarEventAttendees.length === 0) {
return;
}
const dataSourceSchema =
this.workspaceDataSourceService.getSchemaName(workspaceId);
const { flattenedValues, valuesString } =
getFlattenedValuesAndValuesStringForBatchRawQuery(
calendarEventAttendees,
{
calendarEventId: 'uuid',
handle: 'text',
displayName: 'text',
isOrganizer: 'boolean',
responseStatus: `${dataSourceSchema}."calendarEventAttendee_responsestatus_enum"`,
},
);
await this.workspaceDataSourceService.executeRawQuery(
`INSERT INTO ${dataSourceSchema}."calendarEventAttendee" ("calendarEventId", "handle", "displayName", "isOrganizer", "responseStatus") VALUES ${valuesString}`,
flattenedValues,
workspaceId,
transactionManager,
);
}
public async updateCalendarEventAttendees(
calendarEventAttendees: CalendarEventAttendee[],
iCalUIDCalendarEventIdMap: Map<string, string>,