Fix id typing in metadata generated schema (#13596)
In our Graphql schema, ids are typed as UUID. Our FE codegen is typing it as 'any', unless we say otherwise. Fixing it and fixing the impacts in the codebase
This commit is contained in:
+22
-5
@@ -39,11 +39,6 @@ export const mapFieldMetadataToGraphQLQuery = ({
|
||||
|
||||
const fieldIsNonCompositeField = isNonCompositeField(fieldType);
|
||||
|
||||
const objectPermission = getObjectPermissionsForObject(
|
||||
objectPermissionsByObjectMetadataId,
|
||||
fieldMetadata.relation?.targetObjectMetadata.id,
|
||||
);
|
||||
|
||||
if (fieldIsNonCompositeField) {
|
||||
return gqlField;
|
||||
}
|
||||
@@ -66,6 +61,17 @@ export const mapFieldMetadataToGraphQLQuery = ({
|
||||
isDefined(objectPermissionsByObjectMetadataId) &&
|
||||
isDefined(relationMetadataItem.id)
|
||||
) {
|
||||
if (!isDefined(fieldMetadata.relation?.targetObjectMetadata.id)) {
|
||||
throw new Error(
|
||||
`Target object metadata id not found with field metadata ${fieldMetadata.name}`,
|
||||
);
|
||||
}
|
||||
|
||||
const objectPermission = getObjectPermissionsForObject(
|
||||
objectPermissionsByObjectMetadataId,
|
||||
fieldMetadata.relation?.targetObjectMetadata.id,
|
||||
);
|
||||
|
||||
if (!objectPermission.canReadObjectRecords) {
|
||||
return '';
|
||||
}
|
||||
@@ -105,6 +111,17 @@ ${mapObjectMetadataToGraphQLQuery({
|
||||
isDefined(objectPermissionsByObjectMetadataId) &&
|
||||
isDefined(relationMetadataItem.id)
|
||||
) {
|
||||
if (!isDefined(fieldMetadata.relation?.targetObjectMetadata.id)) {
|
||||
throw new Error(
|
||||
`Target object metadata id not found with field metadata ${fieldMetadata.name}`,
|
||||
);
|
||||
}
|
||||
|
||||
const objectPermission = getObjectPermissionsForObject(
|
||||
objectPermissionsByObjectMetadataId,
|
||||
fieldMetadata.relation?.targetObjectMetadata.id,
|
||||
);
|
||||
|
||||
if (!objectPermission.canReadObjectRecords) {
|
||||
return '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user