refactor: merge FieldType and FieldMetadataType (#4504)
* refactor: merge FieldType and FieldMetadataType * fix: fix args passed to assertFieldMetadata * fix: omit RawJson from supported types in settings
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { isUndefined } from '@sniptt/guards';
|
||||
|
||||
import { FieldType } from '@/object-record/record-field/types/FieldType';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
import { FieldMetadataItem } from '../types/FieldMetadataItem';
|
||||
|
||||
@ -13,18 +13,20 @@ export const shouldFieldBeQueried = ({
|
||||
depth?: number;
|
||||
eagerLoadedRelations?: Record<string, boolean>;
|
||||
}): any => {
|
||||
const fieldType = field.type as FieldType;
|
||||
|
||||
if (!isUndefined(depth) && depth < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isUndefined(depth) && depth < 1 && fieldType === 'RELATION') {
|
||||
if (
|
||||
!isUndefined(depth) &&
|
||||
depth < 1 &&
|
||||
field.type === FieldMetadataType.Relation
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
fieldType === 'RELATION' &&
|
||||
field.type === FieldMetadataType.Relation &&
|
||||
!isUndefined(eagerLoadedRelations) &&
|
||||
(isUndefined(eagerLoadedRelations[field.name]) ||
|
||||
!eagerLoadedRelations[field.name])
|
||||
|
||||
Reference in New Issue
Block a user