Add workflow statuses (#6765)
Following figma updates https://www.figma.com/design/PNBfTgOVraw557OXChYagk/Explo?node-id=21872-7929&t=DOUzd6rzwr6lprcs-0 - No activity targets for workflow entities for now - Adding a direct relation between workflow run et workflow - Adding a status on the version (draft, active, deactivated) - Adding a list of statuses on workflow - publishedVersionId => lastPublishedVersionId Also adding: - the endpoint to deactivate a version
This commit is contained in:
@ -32,7 +32,7 @@ export class RunWorkflowJob {
|
||||
await this.workflowRunWorkspaceService.startWorkflowRun(workflowRunId);
|
||||
|
||||
const workflowVersion =
|
||||
await this.workflowCommonWorkspaceService.getWorkflowVersion(
|
||||
await this.workflowCommonWorkspaceService.getWorkflowVersionOrFail(
|
||||
workflowVersionId,
|
||||
);
|
||||
|
||||
|
||||
@ -10,4 +10,5 @@ export class WorkflowRunException extends CustomException {
|
||||
export enum WorkflowRunExceptionCode {
|
||||
WORKFLOW_RUN_NOT_FOUND = 'WORKFLOW_RUN_NOT_FOUND',
|
||||
INVALID_OPERATION = 'INVALID_OPERATION',
|
||||
INVALID_INPUT = 'INVALID_INPUT',
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
import { WorkflowCommonModule } from 'src/modules/workflow/common/workflow-common.module';
|
||||
import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/workflow-run/workflow-run.workspace-service';
|
||||
|
||||
@Module({
|
||||
imports: [WorkflowCommonModule],
|
||||
providers: [WorkflowRunWorkspaceService],
|
||||
exports: [WorkflowRunWorkspaceService],
|
||||
})
|
||||
|
||||
@ -6,6 +6,7 @@ import {
|
||||
WorkflowRunStatus,
|
||||
WorkflowRunWorkspaceEntity,
|
||||
} from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity';
|
||||
import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/workflow-common.workspace-service';
|
||||
import {
|
||||
WorkflowRunException,
|
||||
WorkflowRunExceptionCode,
|
||||
@ -13,7 +14,10 @@ import {
|
||||
|
||||
@Injectable()
|
||||
export class WorkflowRunWorkspaceService {
|
||||
constructor(private readonly twentyORMManager: TwentyORMManager) {}
|
||||
constructor(
|
||||
private readonly twentyORMManager: TwentyORMManager,
|
||||
private readonly workflowCommonWorkspaceService: WorkflowCommonWorkspaceService,
|
||||
) {}
|
||||
|
||||
async createWorkflowRun(workflowVersionId: string, createdBy: ActorMetadata) {
|
||||
const workflowRunRepository =
|
||||
@ -21,10 +25,16 @@ export class WorkflowRunWorkspaceService {
|
||||
'workflowRun',
|
||||
);
|
||||
|
||||
const workflowVersion =
|
||||
await this.workflowCommonWorkspaceService.getWorkflowVersionOrFail(
|
||||
workflowVersionId,
|
||||
);
|
||||
|
||||
return (
|
||||
await workflowRunRepository.save({
|
||||
workflowVersionId,
|
||||
createdBy,
|
||||
workflowId: workflowVersion.workflowId,
|
||||
status: WorkflowRunStatus.NOT_STARTED,
|
||||
})
|
||||
).id;
|
||||
|
||||
Reference in New Issue
Block a user