4736 add listener on calendarchannel isautocontactcreationenabled (#4913)

Closes #4736
This commit is contained in:
bosiraphael
2024-04-11 17:57:19 +02:00
committed by GitHub
parent 7211730570
commit 8853408264
11 changed files with 186 additions and 62 deletions

View File

@ -263,4 +263,33 @@ export class CalendarEventParticipantRepository {
return calendarEventParticipants;
}
public async getByCalendarChannelIdWithoutPersonIdAndWorkspaceMemberId(
calendarChannelId: string,
workspaceId: string,
transactionManager?: EntityManager,
): Promise<CalendarEventParticipantWithId[]> {
if (!workspaceId) {
throw new Error('WorkspaceId is required');
}
const dataSourceSchema =
this.workspaceDataSourceService.getSchemaName(workspaceId);
const calendarEventParticipants: CalendarEventParticipantWithId[] =
await this.workspaceDataSourceService.executeRawQuery(
`SELECT "calendarEventParticipant".*
FROM ${dataSourceSchema}."calendarEventParticipant" AS "calendarEventParticipant"
LEFT JOIN ${dataSourceSchema}."calendarEvent" AS "calendarEvent" ON "calendarEventParticipant"."calendarEventId" = "calendarEvent"."id"
LEFT JOIN ${dataSourceSchema}."calendarChannelEventAssociation" AS "calendarChannelEventAssociation" ON "calendarEvent"."id" = "calendarChannelEventAssociation"."calendarEventId"
WHERE "calendarChannelEventAssociation"."calendarChannelId" = $1
AND "calendarEventParticipant"."personId" IS NULL
AND "calendarEventParticipant"."workspaceMemberId" IS NULL`,
[calendarChannelId],
workspaceId,
transactionManager,
);
return calendarEventParticipants;
}
}