Improve messaging/calendar create contact performance (#5314)

In this PR, I'm refactoring the way we associate messageParticipant post
person/company creation. Instead of looking a all person without
participant, we are passing the one that were just created.

Also, I'm making sure the message and messageParticipant creation
transaction is commited before creating person/company creation (and
then messageParticipant association)
This commit is contained in:
Charles Bochet
2024-05-06 23:43:18 +02:00
committed by GitHub
parent 5f467ab5ca
commit a2017eaeb7
11 changed files with 154 additions and 336 deletions

View File

@ -56,7 +56,7 @@ export class PersonRepository {
}[],
workspaceId: string,
transactionManager?: EntityManager,
): Promise<void> {
): Promise<ObjectRecord<PersonObjectMetadata>[]> {
const dataSourceSchema =
this.workspaceDataSourceService.getSchemaName(workspaceId);
@ -81,7 +81,7 @@ export class PersonRepository {
});
return await this.workspaceDataSourceService.executeRawQuery(
`INSERT INTO ${dataSourceSchema}.person (id, email, "nameFirstName", "nameLastName", "companyId", "position") VALUES ${valuesString}`,
`INSERT INTO ${dataSourceSchema}.person (id, email, "nameFirstName", "nameLastName", "companyId", "position") VALUES ${valuesString} RETURNING *`,
flattenedValues,
workspaceId,
transactionManager,