[Flexible-schema] Refactor gql query runner to emit api event before processing to gql types (#8596)

Fixes https://github.com/twentyhq/twenty/issues/8300

## Context
API events were created too late and were already formatted as Gql
responses (including nesting with edges/node/type + formatting that
should not exist in an event payload). This PR moves the emit logic to
the resolver where we actually do the DB query
Note: Also added RESTORED events
This commit is contained in:
Weiko
2024-11-21 18:11:28 +01:00
committed by GitHub
parent 8f5515cab3
commit 1c04b2b0b7
46 changed files with 1251 additions and 1049 deletions

View File

@ -15,24 +15,32 @@ export const getResolverName = (
return `${camelCase(objectMetadata.nameSingular)}`;
case 'findDuplicates':
return `${camelCase(objectMetadata.nameSingular)}Duplicates`;
case 'createMany':
return `create${pascalCase(objectMetadata.namePlural)}`;
case 'createOne':
return `create${pascalCase(objectMetadata.nameSingular)}`;
case 'createMany':
return `create${pascalCase(objectMetadata.namePlural)}`;
case 'updateOne':
return `update${pascalCase(objectMetadata.nameSingular)}`;
case 'deleteOne':
return `delete${pascalCase(objectMetadata.nameSingular)}`;
case 'destroyOne':
return `destroy${pascalCase(objectMetadata.nameSingular)}`;
case 'updateMany':
return `update${pascalCase(objectMetadata.namePlural)}`;
case 'restoreMany':
return `restore${pascalCase(objectMetadata.namePlural)}`;
case 'deleteOne':
return `delete${pascalCase(objectMetadata.nameSingular)}`;
case 'deleteMany':
return `delete${pascalCase(objectMetadata.namePlural)}`;
case 'destroyOne':
return `destroy${pascalCase(objectMetadata.nameSingular)}`;
case 'destroyMany':
return `destroy${pascalCase(objectMetadata.namePlural)}`;
case 'restoreOne':
return `restore${pascalCase(objectMetadata.nameSingular)}`;
case 'restoreMany':
return `restore${pascalCase(objectMetadata.namePlural)}`;
case 'search':
return `search${pascalCase(objectMetadata.namePlural)}`;
default: