Add isInactive to FieldMetadata decorator (#6623)

This PR was created by [GitStart](https://gitstart.com/) to address the
requirements from this ticket:
[TWNTY-4145](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-4145).
This ticket was imported from:
[TWNTY-4145](https://github.com/twentyhq/twenty/issues/4145)

 --- 
### Description
This PR introduces the @isInActive() decorator to the standard field
metadata. \
- This gives the ability to allow workspaces to be able to be created
with standard fields as inactive *Helps prevent polluting existing
workspaces
- A new standard field can be added to* eg company-workspace-entity.ts
and the @WorkspaceIsInActive() decorator can be added to create it in
deactivated mode
sync-metadata command: `yarn command:prod workspace:sync-metadata -f`

### Refs
#4145 

### Demo

<https://www.loom.com/share/10c13e2614d749809cfe2d2d847e963e?sid=017bbfcf-53c6-4205-8ffc-8a09c416220a>\

<https://www.loom.com/share/6ab86bd36f344c999cb8dacdb82c7bb0?sid=13ac78a2-de44-4772-bb54-7b57975e7360>\

Fixes: #4145

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
gitstart-app[bot]
2024-08-22 18:37:06 +02:00
committed by GitHub
parent 1eeeae8564
commit 7ca091faa5
6 changed files with 21 additions and 6 deletions

View File

@ -19,6 +19,7 @@ export interface WorkspaceFieldOptions<
defaultValue?: FieldMetadataDefaultValue<T>;
options?: FieldMetadataOptions<T>;
settings?: FieldMetadataSettings<T>;
isActive?: boolean;
}
export function WorkspaceField<T extends FieldMetadataType>(
@ -75,6 +76,7 @@ export function WorkspaceField<T extends FieldMetadataType>(
isSystem,
gate,
isDeprecated,
isActive: options.isActive,
});
};
}

View File

@ -78,4 +78,9 @@ export interface WorkspaceFieldMetadataArgs {
* Is deprecated field.
*/
readonly isDeprecated?: boolean;
/**
* Is active field.
*/
readonly isActive?: boolean;
}

View File

@ -81,4 +81,9 @@ export interface WorkspaceRelationMetadataArgs {
* Field gate.
*/
readonly gate?: Gate;
/**
* Is active field.
*/
readonly isActive?: boolean;
}