mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
feat(core): Allow transferring workflows from any project to any team project (#9534)
This commit is contained in:
@@ -40,6 +40,7 @@ import { ApplicationError } from 'n8n-workflow';
|
||||
import { In, type FindOptionsRelations } from '@n8n/typeorm';
|
||||
import type { Project } from '@/databases/entities/Project';
|
||||
import { ProjectRelationRepository } from '@/databases/repositories/projectRelation.repository';
|
||||
import { z } from 'zod';
|
||||
|
||||
@RestController('/workflows')
|
||||
export class WorkflowsController {
|
||||
@@ -460,4 +461,16 @@ export class WorkflowsController {
|
||||
workflow,
|
||||
});
|
||||
}
|
||||
|
||||
@Put('/:workflowId/transfer')
|
||||
@ProjectScope('workflow:move')
|
||||
async transfer(req: WorkflowRequest.Transfer) {
|
||||
const body = z.object({ destinationProjectId: z.string() }).parse(req.body);
|
||||
|
||||
return await this.enterpriseWorkflowService.transferOne(
|
||||
req.user,
|
||||
req.params.workflowId,
|
||||
body.destinationProjectId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user