fieldmetadatatype + featurelfag creation (#13021)
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -130,6 +130,12 @@ describe('mapFieldMetadataToGraphqlQuery', () => {
|
||||
} as FieldMetadataDefaultSettings;
|
||||
}
|
||||
|
||||
if (fieldMetadataType === FieldMetadataType.MORPH_RELATION) {
|
||||
field.settings = {
|
||||
relationType: RelationType.MANY_TO_ONE,
|
||||
} as FieldMetadataDefaultSettings;
|
||||
}
|
||||
|
||||
expect(
|
||||
mapFieldMetadataToGraphqlQuery(objectMetadataMapsMock, field),
|
||||
).toBeDefined();
|
||||
|
||||
@ -38,11 +38,15 @@ export const mapFieldMetadataToGraphqlQuery = (
|
||||
FieldMetadataType.TS_VECTOR,
|
||||
].includes(fieldType);
|
||||
|
||||
const isRelation =
|
||||
isFieldMetadataInterfaceOfType(field, FieldMetadataType.RELATION) ||
|
||||
isFieldMetadataInterfaceOfType(field, FieldMetadataType.MORPH_RELATION);
|
||||
|
||||
if (fieldIsSimpleValue) {
|
||||
return field.name;
|
||||
} else if (
|
||||
maxDepthForRelations > 0 &&
|
||||
isFieldMetadataInterfaceOfType(field, FieldMetadataType.RELATION) &&
|
||||
isRelation &&
|
||||
field.settings?.relationType === RelationType.MANY_TO_ONE
|
||||
) {
|
||||
const targetObjectMetadataId = field.relationTargetObjectMetadataId;
|
||||
@ -69,7 +73,7 @@ export const mapFieldMetadataToGraphqlQuery = (
|
||||
}`;
|
||||
} else if (
|
||||
maxDepthForRelations > 0 &&
|
||||
isFieldMetadataInterfaceOfType(field, FieldMetadataType.RELATION) &&
|
||||
isRelation &&
|
||||
field.settings?.relationType === RelationType.ONE_TO_MANY
|
||||
) {
|
||||
const targetObjectMetadataId = field.relationTargetObjectMetadataId;
|
||||
|
||||
Reference in New Issue
Block a user