Leverage workspace activationStatus to decide if a workspace is activated or not (#6497)

An ACTIVE workspace is a workspace that has a complete workspaceSchema
and is authorized to be browsed by users.

In this PR, I'm:
- introducing a new activationStatus: PENDING_CREATION (existing ACTIVE
/ INACTIVE)
- removing workspaceService.isWorkspaceActivated (based on
workspaceSchema existence which is not robust and checking
activationStatus.ACTIVE instead)
- removing dynamic activationStatus field on worksapce resolver (we can
use the postgres column directly now that data has been migrated)
- on user sign up creating the workspace in PENDING_CREATION, and on
workspace activation setting it to ACTIVE
- only re-activating a workspace if the current activationStatus is
INACTIVE through billing webhooks (a PENDING_CREATION should stay
PENDING and ACTIVE should stay ACTIVE)
This commit is contained in:
Charles Bochet
2024-08-01 17:05:15 +02:00
committed by GitHub
parent 1a90df8961
commit 5c92ab937e
12 changed files with 217 additions and 50 deletions

View File

@ -1054,7 +1054,7 @@ export type ServerlessFunctionExecutionResult = {
status: ServerlessFunctionExecutionStatus;
};
/** Status of the table */
/** Status of the serverless function execution */
export enum ServerlessFunctionExecutionStatus {
Error = 'ERROR',
Success = 'SUCCESS'
@ -1397,7 +1397,8 @@ export type WorkspaceFeatureFlagsArgs = {
export enum WorkspaceActivationStatus {
Active = 'ACTIVE',
Inactive = 'INACTIVE'
Inactive = 'INACTIVE',
PendingCreation = 'PENDING_CREATION'
}
export type WorkspaceEdge = {