4746 create created listener on blocklist (#5031)

Closes #4746 for messaging.

I will create another PR to implement the listener on calendar.
This commit is contained in:
bosiraphael
2024-04-18 15:06:13 +02:00
committed by GitHub
parent c42fcf435a
commit 8702c71d45
9 changed files with 202 additions and 2 deletions

View File

@ -12,6 +12,29 @@ export class BlocklistRepository {
private readonly workspaceDataSourceService: WorkspaceDataSourceService,
) {}
public async getById(
id: string,
workspaceId: string,
transactionManager?: EntityManager,
): Promise<ObjectRecord<BlocklistObjectMetadata> | null> {
const dataSourceSchema =
this.workspaceDataSourceService.getSchemaName(workspaceId);
const blocklistItems =
await this.workspaceDataSourceService.executeRawQuery(
`SELECT * FROM ${dataSourceSchema}."blocklist" WHERE "id" = $1`,
[id],
workspaceId,
transactionManager,
);
if (!blocklistItems || blocklistItems.length === 0) {
return null;
}
return blocklistItems[0];
}
public async getByWorkspaceMemberId(
workspaceMemberId: string,
workspaceId: string,