feat: Add Workflow duplicate step (#15622)
## Description - This PR address issue https://github.com/twentyhq/core-team-issues/issues/1800 - Added workflow duplicate option in workflow sidepanel - Introduced DuplicateWorkflow.ts mutuation - Updated graphql generated metadata with new duplicate type ## Visual Appearanc <img width="1792" height="1031" alt="Screenshot 2025-11-07 at 4 46 22 PM" src="https://github.com/user-attachments/assets/d75f99df-ae18-4b41-a5f4-21c50010cdbc" /> https://github.com/user-attachments/assets/3dbf73cf-f4dd-484c-94a3-29577cfbac25 --------- Co-authored-by: Devessier <baptiste@devessier.fr>
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
import { Field, InputType } from '@nestjs/graphql';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@InputType()
|
||||
export class DuplicateWorkflowInput {
|
||||
@Field(() => UUIDScalarType, {
|
||||
description: 'Workflow ID to duplicate',
|
||||
nullable: false,
|
||||
})
|
||||
workflowIdToDuplicate: string;
|
||||
|
||||
@Field(() => UUIDScalarType, {
|
||||
description: 'Workflow version ID to copy',
|
||||
nullable: false,
|
||||
})
|
||||
workflowVersionIdToCopy: string;
|
||||
}
|
||||
+14
@@ -14,6 +14,7 @@ import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';
|
||||
import { PermissionFlagType } from 'src/engine/metadata-modules/permissions/constants/permission-flag-type.constants';
|
||||
import { PermissionsGraphqlApiExceptionFilter } from 'src/engine/metadata-modules/permissions/utils/permissions-graphql-api-exception.filter';
|
||||
import { WorkflowVersionWorkspaceService } from 'src/modules/workflow/workflow-builder/workflow-version/workflow-version.workspace-service';
|
||||
import { DuplicateWorkflowInput } from 'src/engine/core-modules/workflow/dtos/duplicate-workflow-input.dto';
|
||||
|
||||
@Resolver()
|
||||
@UsePipes(ResolverValidationPipe)
|
||||
@@ -47,6 +48,19 @@ export class WorkflowVersionResolver {
|
||||
});
|
||||
}
|
||||
|
||||
@Mutation(() => WorkflowVersionDTO)
|
||||
async duplicateWorkflow(
|
||||
@AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
|
||||
@Args('input')
|
||||
{ workflowIdToDuplicate, workflowVersionIdToCopy }: DuplicateWorkflowInput,
|
||||
): Promise<WorkflowVersionDTO> {
|
||||
return this.workflowVersionWorkspaceService.duplicateWorkflow({
|
||||
workspaceId,
|
||||
workflowIdToDuplicate,
|
||||
workflowVersionIdToCopy,
|
||||
});
|
||||
}
|
||||
|
||||
@Mutation(() => Boolean)
|
||||
async updateWorkflowVersionPositions(
|
||||
@AuthWorkspace() { id: workspaceId }: WorkspaceEntity,
|
||||
|
||||
Reference in New Issue
Block a user