Fix enum defaultValue broken (#4251)

* Fix enum defaultValue broken

* Fix

* Fix
This commit is contained in:
Charles Bochet
2024-02-29 19:35:00 +01:00
committed by GitHub
parent 72ae6e44b3
commit ad4b3d0d59
5 changed files with 15 additions and 9 deletions

View File

@ -235,6 +235,10 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
const updatedFieldMetadata = await super.updateOne(id, {
...updatableFieldInput,
defaultValue: updatableFieldInput.defaultValue
? // Todo: we need to rework DefaultValue typing and format to be simpler, there is no need to have this complexity
{ value: updatableFieldInput.defaultValue as unknown as string }
: null,
// If the name is updated, the targetColumnMap should be updated as well
targetColumnMap: updatableFieldInput.name
? generateTargetColumnMap(

View File

@ -52,6 +52,7 @@ export class EnumColumnActionFactory extends ColumnActionAbstractFactory<EnumFie
const defaultValue =
alteredFieldMetadata.defaultValue?.value ?? options?.defaultValue;
const serializedDefaultValue = serializeDefaultValue(defaultValue);
const enumOptions = alteredFieldMetadata.options
? [
...alteredFieldMetadata.options.map((option) => {