feat: workspace health target column map fix (#3932)
* feat: workspace health fix target column map * fix: remove log * feat: refactor health fixer * fix: default-value issue and health check not working with composite * fix: enhance target column map fix * feat: create workspace migrations for target-column-map issues * feat: enhance workspace-health issue detection
This commit is contained in:
@ -0,0 +1,5 @@
|
||||
export const customNamePrefix = '_';
|
||||
|
||||
export const computeCustomName = (name: string, isCustom: boolean) => {
|
||||
return isCustom ? `${customNamePrefix}${name}` : name;
|
||||
};
|
||||
@ -0,0 +1,21 @@
|
||||
import { FieldMetadataInterface } from 'src/metadata/field-metadata/interfaces/field-metadata.interface';
|
||||
|
||||
import { FieldMetadataEntity } from 'src/metadata/field-metadata/field-metadata.entity';
|
||||
import { isCompositeFieldMetadataType } from 'src/metadata/field-metadata/utils/is-composite-field-metadata-type.util';
|
||||
import { BasicFieldMetadataType } from 'src/metadata/workspace-migration/factories/basic-column-action.factory';
|
||||
|
||||
import { computeCustomName } from './compute-custom-name.util';
|
||||
|
||||
export const computeFieldTargetColumn = (
|
||||
fieldMetadata:
|
||||
| FieldMetadataEntity<BasicFieldMetadataType>
|
||||
| FieldMetadataInterface<BasicFieldMetadataType>,
|
||||
) => {
|
||||
if (isCompositeFieldMetadataType(fieldMetadata.type)) {
|
||||
throw new Error(
|
||||
"Composite field metadata should not be computed here, as they're split into multiple fields.",
|
||||
);
|
||||
}
|
||||
|
||||
return computeCustomName(fieldMetadata.name, fieldMetadata.isCustom ?? false);
|
||||
};
|
||||
@ -1,5 +1,7 @@
|
||||
import { ObjectMetadataInterface } from 'src/metadata/field-metadata/interfaces/object-metadata.interface';
|
||||
|
||||
import { computeCustomName } from './compute-custom-name.util';
|
||||
|
||||
export const computeObjectTargetTable = (
|
||||
objectMetadata: ObjectMetadataInterface,
|
||||
) => {
|
||||
@ -8,7 +10,3 @@ export const computeObjectTargetTable = (
|
||||
objectMetadata.isCustom,
|
||||
);
|
||||
};
|
||||
|
||||
export const computeCustomName = (name: string, isCustom: boolean) => {
|
||||
return isCustom ? `_${name}` : name;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user