diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useBooleanField.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useBooleanField.ts index 984ff9f929b8..97284c649861 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useBooleanField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useBooleanField.ts @@ -2,6 +2,7 @@ import { useContext } from 'react'; import { useRecoilState } from 'recoil'; import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; +import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '../../contexts/FieldContext'; import { assertFieldMetadata } from '../../types/guards/assertFieldMetadata'; @@ -10,7 +11,11 @@ import { isFieldBoolean } from '../../types/guards/isFieldBoolean'; export const useBooleanField = () => { const { entityId, fieldDefinition, hotkeyScope } = useContext(FieldContext); - assertFieldMetadata('BOOLEAN', isFieldBoolean, fieldDefinition); + assertFieldMetadata( + FieldMetadataType.Boolean, + isFieldBoolean, + fieldDefinition, + ); const fieldName = fieldDefinition.metadata.fieldName; diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useCurrencyField.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useCurrencyField.ts index 998904de6144..df1bd072d055 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useCurrencyField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useCurrencyField.ts @@ -3,6 +3,7 @@ import { useRecoilState, useRecoilValue } from 'recoil'; import { useRecordFieldInput } from '@/object-record/record-field/hooks/useRecordFieldInput'; import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; +import { FieldMetadataType } from '~/generated-metadata/graphql'; import { canBeCastAsIntegerOrNull } from '~/utils/cast-as-integer-or-null'; import { convertCurrencyToCurrencyMicros } from '~/utils/convert-currency-amount'; @@ -16,7 +17,11 @@ import { isFieldCurrencyValue } from '../../types/guards/isFieldCurrencyValue'; export const useCurrencyField = () => { const { entityId, fieldDefinition, hotkeyScope } = useContext(FieldContext); - assertFieldMetadata('CURRENCY', isFieldCurrency, fieldDefinition); + assertFieldMetadata( + FieldMetadataType.Currency, + isFieldCurrency, + fieldDefinition, + ); const fieldName = fieldDefinition.metadata.fieldName; diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useDateTimeField.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useDateTimeField.ts index ebc85c116d9b..3043784fc325 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useDateTimeField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useDateTimeField.ts @@ -4,6 +4,7 @@ import { useRecoilState } from 'recoil'; import { useRecordFieldInput } from '@/object-record/record-field/hooks/useRecordFieldInput'; import { FieldDateTimeValue } from '@/object-record/record-field/types/FieldMetadata'; import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; +import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '../../contexts/FieldContext'; import { assertFieldMetadata } from '../../types/guards/assertFieldMetadata'; @@ -13,7 +14,11 @@ export const useDateTimeField = () => { const { entityId, fieldDefinition, hotkeyScope, clearable } = useContext(FieldContext); - assertFieldMetadata('DATE_TIME', isFieldDateTime, fieldDefinition); + assertFieldMetadata( + FieldMetadataType.DateTime, + isFieldDateTime, + fieldDefinition, + ); const fieldName = fieldDefinition.metadata.fieldName; diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useEmailField.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useEmailField.ts index 4b0b6dd2c615..ba9ad1f8f66c 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useEmailField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useEmailField.ts @@ -4,6 +4,7 @@ import { useRecoilState, useRecoilValue } from 'recoil'; import { useRecordFieldInput } from '@/object-record/record-field/hooks/useRecordFieldInput'; import { FieldEmailValue } from '@/object-record/record-field/types/FieldMetadata'; import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; +import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '../../contexts/FieldContext'; import { assertFieldMetadata } from '../../types/guards/assertFieldMetadata'; @@ -12,7 +13,7 @@ import { isFieldEmail } from '../../types/guards/isFieldEmail'; export const useEmailField = () => { const { entityId, fieldDefinition, hotkeyScope } = useContext(FieldContext); - assertFieldMetadata('EMAIL', isFieldEmail, fieldDefinition); + assertFieldMetadata(FieldMetadataType.Email, isFieldEmail, fieldDefinition); const fieldName = fieldDefinition.metadata.fieldName; diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useFullNameField.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useFullNameField.ts index 77a0c0b394fc..553fdde86cca 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useFullNameField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useFullNameField.ts @@ -3,6 +3,7 @@ import { useRecoilState, useRecoilValue } from 'recoil'; import { useRecordFieldInput } from '@/object-record/record-field/hooks/useRecordFieldInput'; import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; +import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '../../contexts/FieldContext'; import { usePersistField } from '../../hooks/usePersistField'; @@ -14,7 +15,11 @@ import { isFieldFullNameValue } from '../../types/guards/isFieldFullNameValue'; export const useFullNameField = () => { const { entityId, fieldDefinition, hotkeyScope } = useContext(FieldContext); - assertFieldMetadata('FULL_NAME', isFieldFullName, fieldDefinition); + assertFieldMetadata( + FieldMetadataType.FullName, + isFieldFullName, + fieldDefinition, + ); const fieldName = fieldDefinition.metadata.fieldName; diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useLinkField.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useLinkField.ts index 0af2a0d105f5..7a422f72bd14 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useLinkField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useLinkField.ts @@ -3,6 +3,7 @@ import { useRecoilState, useRecoilValue } from 'recoil'; import { useRecordFieldInput } from '@/object-record/record-field/hooks/useRecordFieldInput'; import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; +import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '../../contexts/FieldContext'; import { usePersistField } from '../../hooks/usePersistField'; @@ -14,7 +15,7 @@ import { isFieldLinkValue } from '../../types/guards/isFieldLinkValue'; export const useLinkField = () => { const { entityId, fieldDefinition, hotkeyScope } = useContext(FieldContext); - assertFieldMetadata('LINK', isFieldLink, fieldDefinition); + assertFieldMetadata(FieldMetadataType.Link, isFieldLink, fieldDefinition); const fieldName = fieldDefinition.metadata.fieldName; diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useNumberField.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useNumberField.ts index 1ddaf7385f15..9ae483bde854 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useNumberField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useNumberField.ts @@ -4,6 +4,7 @@ import { useRecoilState, useRecoilValue } from 'recoil'; import { useRecordFieldInput } from '@/object-record/record-field/hooks/useRecordFieldInput'; import { FieldNumberValue } from '@/object-record/record-field/types/FieldMetadata'; import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; +import { FieldMetadataType } from '~/generated-metadata/graphql'; import { canBeCastAsIntegerOrNull, castAsIntegerOrNull, @@ -17,7 +18,7 @@ import { isFieldNumber } from '../../types/guards/isFieldNumber'; export const useNumberField = () => { const { entityId, fieldDefinition, hotkeyScope } = useContext(FieldContext); - assertFieldMetadata('NUMBER', isFieldNumber, fieldDefinition); + assertFieldMetadata(FieldMetadataType.Number, isFieldNumber, fieldDefinition); const fieldName = fieldDefinition.metadata.fieldName; diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/usePhoneField.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/usePhoneField.ts index 5e343d1f8d60..3f8891214d57 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/usePhoneField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/usePhoneField.ts @@ -5,6 +5,7 @@ import { useRecoilState, useRecoilValue } from 'recoil'; import { useRecordFieldInput } from '@/object-record/record-field/hooks/useRecordFieldInput'; import { FieldPhoneValue } from '@/object-record/record-field/types/FieldMetadata'; import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; +import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '../../contexts/FieldContext'; import { usePersistField } from '../../hooks/usePersistField'; @@ -14,7 +15,7 @@ import { isFieldPhone } from '../../types/guards/isFieldPhone'; export const usePhoneField = () => { const { entityId, fieldDefinition, hotkeyScope } = useContext(FieldContext); - assertFieldMetadata('TEXT', isFieldPhone, fieldDefinition); + assertFieldMetadata(FieldMetadataType.Text, isFieldPhone, fieldDefinition); const fieldName = fieldDefinition.metadata.fieldName; diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useRelationField.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useRelationField.ts index bd8355b80dc5..f61b22df666d 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useRelationField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useRelationField.ts @@ -5,6 +5,7 @@ import { useGetButtonIcon } from '@/object-record/record-field/hooks/useGetButto import { useRecordFieldInput } from '@/object-record/record-field/hooks/useRecordFieldInput'; import { FieldRelationValue } from '@/object-record/record-field/types/FieldMetadata'; import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; +import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '../../contexts/FieldContext'; import { assertFieldMetadata } from '../../types/guards/assertFieldMetadata'; @@ -14,7 +15,12 @@ import { isFieldRelation } from '../../types/guards/isFieldRelation'; export const useRelationField = () => { const { entityId, fieldDefinition, maxWidth } = useContext(FieldContext); const button = useGetButtonIcon(); - assertFieldMetadata('RELATION', isFieldRelation, fieldDefinition); + + assertFieldMetadata( + FieldMetadataType.Relation, + isFieldRelation, + fieldDefinition, + ); const fieldName = fieldDefinition.metadata.fieldName; diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useTextField.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useTextField.ts index c3222dda7176..6d3f36aacd52 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useTextField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useTextField.ts @@ -4,6 +4,7 @@ import { useRecoilState, useRecoilValue } from 'recoil'; import { useRecordFieldInput } from '@/object-record/record-field/hooks/useRecordFieldInput'; import { FieldTextValue } from '@/object-record/record-field/types/FieldMetadata'; import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; +import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '../../contexts/FieldContext'; import { assertFieldMetadata } from '../../types/guards/assertFieldMetadata'; @@ -14,7 +15,7 @@ export const useTextField = () => { const { entityId, fieldDefinition, hotkeyScope, maxWidth } = useContext(FieldContext); - assertFieldMetadata('TEXT', isFieldText, fieldDefinition); + assertFieldMetadata(FieldMetadataType.Text, isFieldText, fieldDefinition); const fieldName = fieldDefinition.metadata.fieldName; diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useUuidField.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useUuidField.ts index 8e258ff098db..8a3224c50f65 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useUuidField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useUuidField.ts @@ -4,6 +4,7 @@ import { useRecoilState } from 'recoil'; import { FieldUUidValue } from '@/object-record/record-field/types/FieldMetadata'; import { isFieldUuid } from '@/object-record/record-field/types/guards/isFieldUuid'; import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; +import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '../../contexts/FieldContext'; import { assertFieldMetadata } from '../../types/guards/assertFieldMetadata'; @@ -12,7 +13,7 @@ import { isFieldTextValue } from '../../types/guards/isFieldTextValue'; export const useUuidField = () => { const { entityId, fieldDefinition, hotkeyScope } = useContext(FieldContext); - assertFieldMetadata('UUID', isFieldUuid, fieldDefinition); + assertFieldMetadata(FieldMetadataType.Uuid, isFieldUuid, fieldDefinition); const fieldName = fieldDefinition.metadata.fieldName;