Feat/add other metadata types v2 (#2224)

* Fix view fetch bug

* Finished types

* Removed console.log

* Fixed todo

* Reactivate no console

* Change no-console to warn
This commit is contained in:
Lucas Bordeau
2023-10-26 12:07:43 +02:00
committed by GitHub
parent 00dd046798
commit c335d19c97
20 changed files with 369 additions and 87 deletions

View File

@ -1,9 +1,9 @@
import { gql } from '@apollo/client';
import { FieldType } from '@/ui/data/field/types/FieldType';
import { MetadataObject } from '../types/MetadataObject';
import { mapFieldMetadataToGraphQLQuery } from './mapFieldMetadataToGraphQLQuery';
export const generateFindManyCustomObjectsQuery = ({
metadataObject,
_fromCursor,
@ -18,22 +18,7 @@ export const generateFindManyCustomObjectsQuery = ({
node {
id
${metadataObject.fields
.map((field) => {
// TODO: parse
const fieldType = field.type as FieldType;
if (fieldType === 'text') {
return field.name;
} else if (fieldType === 'url') {
return `
${field.name}
{
text
link
}
`;
}
})
.map(mapFieldMetadataToGraphQLQuery)
.join('\n')}
}
cursor