3921 delete messagethreads after deleting connectedaccount (#3925)

* created listener

* working

---------

Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
bosiraphael
2024-02-13 14:36:55 +01:00
committed by GitHub
parent 1d1976ef22
commit ec48e66eeb
4 changed files with 90 additions and 0 deletions

View File

@ -67,6 +67,22 @@ export class MessageChannelMessageAssociationService {
);
}
public async deleteByMessageChannelId(
messageChannelId: string,
workspaceId: string,
transactionManager?: EntityManager,
) {
const dataSourceSchema =
this.workspaceDataSourceService.getSchemaName(workspaceId);
await this.workspaceDataSourceService.executeRawQuery(
`DELETE FROM ${dataSourceSchema}."messageChannelMessageAssociation" WHERE "messageChannelId" = $1`,
[messageChannelId],
workspaceId,
transactionManager,
);
}
public async deleteByIds(
ids: string[],
workspaceId: string,