Deprecate address standard field (#6087)

Closes #5916

---------

Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
Marie
2024-07-10 18:07:18 +02:00
committed by GitHub
parent b14918c4b5
commit 34d13a7b58
27 changed files with 310 additions and 77 deletions

View File

@ -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,
});
};
}

View File

@ -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(),
);
};
}

View File

@ -73,4 +73,9 @@ export interface WorkspaceFieldMetadataArgs {
* Field gate.
*/
readonly gate?: Gate;
/**
* Is deprecated field.
*/
readonly isDeprecated?: boolean;
}