Fix broken graphql playground (#13287)

Fixes https://github.com/twentyhq/twenty/issues/12991
Also fixes a regression on main where updateEvent are not correctly emit
when calling repository.update()
This commit is contained in:
Charles Bochet
2025-07-19 09:32:26 +02:00
committed by GitHub
parent 19dad8f23a
commit 62202af1a9
4 changed files with 24 additions and 17 deletions

View File

@ -285,7 +285,7 @@ describe('WorkspaceEntityManager', () => {
it('should call createQueryBuilder with permissionOptions for update', async () => {
await entityManager.update('test-entity', {}, {}, mockPermissionOptions);
expect(entityManager['createQueryBuilder']).toHaveBeenCalledWith(
undefined,
'test-entity',
undefined,
undefined,
mockPermissionOptions,

View File

@ -275,6 +275,8 @@ export class WorkspaceEntityManager extends EntityManager {
partialEntity: QueryDeepPartialEntity<Entity>,
permissionOptions?: PermissionOptions,
): Promise<UpdateResult> {
const metadata = this.connection.getMetadata(target);
if (
criteria === undefined ||
criteria === null ||
@ -294,23 +296,23 @@ export class WorkspaceEntityManager extends EntityManager {
Array.isArray(criteria)
) {
return this.createQueryBuilder(
undefined,
undefined,
target,
metadata.name,
undefined,
permissionOptions,
)
.update(target)
.update()
.set(partialEntity)
.whereInIds(criteria)
.execute();
} else {
return this.createQueryBuilder(
undefined,
undefined,
target,
metadata.name,
undefined,
permissionOptions,
)
.update(target)
.update()
.set(partialEntity)
.where(criteria)
.execute();