Remove singular/plural from field-metadata (#2085)

* Remove singular/plural from field-metadata

* revert removing id from create input

* remove console log

* remove console log

* codegen

* missing files

* fix tests
This commit is contained in:
Weiko
2023-10-17 15:21:58 +02:00
committed by GitHub
parent 0d6386bc8d
commit 1344e78acb
32 changed files with 213 additions and 130 deletions

View File

@ -8,8 +8,7 @@ export const convertFieldsToGraphQL = (
acc = '',
) => {
const fieldsMap = new Map(
// TODO: Handle plural for fields when we add relations
fields.map((metadata) => [metadata.nameSingular, metadata]),
fields.map((metadata) => [metadata.name, metadata]),
);
for (const [key, value] of Object.entries(select)) {
@ -29,9 +28,7 @@ export const convertFieldsToGraphQL = (
// Otherwise it means it's a special type with multiple values, so we need fetch all fields
fieldAlias = `
${entries
.map(
([key, value]) => `___${metadata.nameSingular}_${key}: ${value}`,
)
.map(([key, value]) => `___${metadata.name}_${key}: ${value}`)
.join('\n')}
`;
}