-
Notifications
You must be signed in to change notification settings - Fork 11.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): Allow filtering workflows by project and transferring workflows in Public API #10231
feat(core): Allow filtering workflows by project and transferring workflows in Public API #10231
Conversation
if ((projectId && !role) || (!projectId && role)) { | ||
return res.status(400).json({ | ||
message: | ||
'When creating a workflow and specifying s project, please specify both projectId and role', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'When creating a workflow and specifying s project, please specify both projectId and role', | |
'When creating a workflow and specifying a project, please specify both projectId and role', |
const { projectId, role, ...rest } = req.body; | ||
|
||
if ((projectId && !role) || (!projectId && role)) { | ||
return res.status(400).json({ | ||
message: "When updating a workflow's project, please specify both projectId and role", | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transferring workflows should probably be it's own endpoint
return await Db.transaction(async (tx) => { | ||
await tx.update(WorkflowEntity, workflowId, updateData); | ||
await tx.update(SharedWorkflow, { workflowId }, { projectId, role }); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably call EnterpriseWorkflowService.transferOne
, since more things need done to transfer a workflow
const projectRepository = Container.get(ProjectRepository); | ||
|
||
const project = projectId | ||
? await projectRepository.getProjectForUserOrFail(projectId, userId) | ||
: await projectRepository.getPersonalProjectForUserOrFail(userId); | ||
|
||
const createdWorkflow = await createWorkflow( | ||
workflow, | ||
req.user, | ||
project, | ||
role ?? 'workflow:owner', | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check the user's scopes on the project for workflow:create
first
Test summaryRun details
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Cloud |
✅ All Cypress E2E specs passed |
…kflows in Public API (#10231)
Got released with |
…kflows in Public API (#10231)
https://linear.app/n8n/issue/PAY-1788