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:
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user