Add submit form step endpoint (#10538)

- add endpoint to submit form step
- update context and output of workflow run
- resume workflow execution
This commit is contained in:
Thomas Trompette
2025-02-28 10:03:45 +01:00
committed by GitHub
parent 15d3751b73
commit a29c26c8d7
11 changed files with 285 additions and 64 deletions

View File

@ -0,0 +1,24 @@
import { Field, InputType } from '@nestjs/graphql';
import graphqlTypeJson from 'graphql-type-json';
@InputType()
export class SubmitFormStepInput {
@Field(() => String, {
description: 'Workflow version ID',
nullable: false,
})
stepId: string;
@Field(() => String, {
description: 'Workflow run ID',
nullable: false,
})
workflowRunId: string;
@Field(() => graphqlTypeJson, {
description: 'Form response in JSON format',
nullable: false,
})
response: JSON;
}

View File

@ -3,13 +3,14 @@ import { Args, Mutation, Resolver } from '@nestjs/graphql';
import { CreateWorkflowVersionStepInput } from 'src/engine/core-modules/workflow/dtos/create-workflow-version-step-input.dto';
import { DeleteWorkflowVersionStepInput } from 'src/engine/core-modules/workflow/dtos/delete-workflow-version-step-input.dto';
import { SubmitFormStepInput } from 'src/engine/core-modules/workflow/dtos/submit-form-step-input.dto';
import { UpdateWorkflowVersionStepInput } from 'src/engine/core-modules/workflow/dtos/update-workflow-version-step-input.dto';
import { WorkflowActionDTO } from 'src/engine/core-modules/workflow/dtos/workflow-step.dto';
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator';
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard';
import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';
import { WorkflowVersionStepWorkspaceService } from 'src/modules/workflow/workflow-builder/workflow-version/workflow-step/workflow-version-step.workspace-service';
import { WorkflowVersionStepWorkspaceService } from 'src/modules/workflow/workflow-builder/workflow-step/workflow-version-step.workspace-service';
@Resolver()
@UseGuards(WorkspaceAuthGuard, UserAuthGuard)
@ -56,4 +57,20 @@ export class WorkflowVersionStepResolver {
stepId,
});
}
@Mutation(() => Boolean)
async submitFormStep(
@AuthWorkspace() { id: workspaceId }: Workspace,
@Args('input')
{ stepId, workflowRunId, response }: SubmitFormStepInput,
) {
await this.workflowVersionStepWorkspaceService.submitFormStep({
workspaceId,
stepId,
workflowRunId,
response,
});
return true;
}
}