Deprecate address standard field (#6087)
Closes #5916 --------- Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
@ -46,6 +46,13 @@ export function WorkspaceField<T extends FieldMetadataType>(
|
||||
object,
|
||||
propertyKey.toString(),
|
||||
);
|
||||
const isDeprecated =
|
||||
TypedReflect.getMetadata(
|
||||
'workspace:is-deprecated-field-metadata-args',
|
||||
object,
|
||||
propertyKey.toString(),
|
||||
) ?? false;
|
||||
|
||||
const defaultValue = (options.defaultValue ??
|
||||
generateDefaultValue(
|
||||
options.type,
|
||||
@ -65,6 +72,7 @@ export function WorkspaceField<T extends FieldMetadataType>(
|
||||
isNullable,
|
||||
isSystem,
|
||||
gate,
|
||||
isDeprecated,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
||||
|
||||
export function WorkspaceIsDeprecated(): PropertyDecorator {
|
||||
return (object, propertyKey) => {
|
||||
TypedReflect.defineMetadata(
|
||||
'workspace:is-deprecated-field-metadata-args',
|
||||
true,
|
||||
object,
|
||||
propertyKey.toString(),
|
||||
);
|
||||
};
|
||||
}
|
||||
@ -73,4 +73,9 @@ export interface WorkspaceFieldMetadataArgs {
|
||||
* Field gate.
|
||||
*/
|
||||
readonly gate?: Gate;
|
||||
|
||||
/**
|
||||
* Is deprecated field.
|
||||
*/
|
||||
readonly isDeprecated?: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user