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:
@ -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,
|
||||
|
||||
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user