-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat(core): Support create, read, update, delete projects in Public API #10269
feat(core): Support create, read, update, delete projects in Public API #10269
Conversation
async (req: Create, res: Response) => { | ||
await Container.get(ProjectController).createProject(req); | ||
|
||
return res.status(201).send(); |
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.
Shouldn't we at least return the ID of the created project? How else do you know which project was created?
'401': | ||
$ref: '../../../../shared/spec/responses/unauthorized.yml' |
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.
I think we also need 403 here. In case the request identity is missing scopes
await testDb.truncate(['Project', 'User']); | ||
}); | ||
|
||
describe('GET /projects', () => { |
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 we have test cases for each endpoint that unauthenticated requests are denied?
it('if not licensed, should reject', async () => { | ||
/** | ||
* Arrange | ||
*/ | ||
const owner = await createOwner({ withApiKey: true }); | ||
|
||
/** | ||
* Act | ||
*/ | ||
const response = await testServer.publicApiAgentFor(owner).get('/projects'); | ||
|
||
/** | ||
* Assert | ||
*/ | ||
expect(response.status).toBe(403); | ||
expect(response.body).toHaveProperty( | ||
'message', | ||
new FeatureNotLicensedError('feat:projectRole:admin').message, | ||
); | ||
}); |
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.
The test cases for unlicensed requests are all pretty similar. Maybe they could be combined with test.each
? No objections in keeping them like this as well
Thanks for reviewing! For future context, we discussed in the team that these PRs are okay to be kept basic as they're meant to unblock customers - the whole Public API needs heavy rework. |
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.
For future context, we discussed in the team that these PRs are okay to be kept basic as they're meant to unblock customers
That makes sense. Can we create a single tracking issue for public api refactor, so that we can move these valid review comments in there.
✅ All Cypress E2E specs passed |
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 |
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.
🚀
✅ All Cypress E2E specs passed |
* master: refactor(core): Clean up event relays (no-changelog) (#10284) fix(editor): Fix execution retry button (#10275) feat(core): Show sub-node error on the logs pane. Open logs pane on sub-node error (#10248) refactor(core): Move instanceRole to InstanceSettings (no-changelog) (#10242) feat(core): Allow filtering executions and users by project in Public API (#10250) fix(core): Make execution and its data creation atomic (#10276) refactor(core): Mark schema env vars used by cloud hooks (no-changelog) (#10283) ci: Fix DB tests (no-changelog) (#10282) feat(core): Support create, delete, edit role for users in Public API (#10279) refactor(core): Decouple post workflow execute event from internal hooks (no-changelog) (#10280) feat(core): Allow transferring credentials in Public API (#10259) feat(core): Support create, read, update, delete projects in Public API (#10269) ci: Introduce lint rule `no-type-unsafe-event-emitter` (no-changelog) (#10254) fix(core): Surface enterprise trial error message (#10267) fix(editor): Enable moving resources only if team projects are available by the license (#10271) fix(core): Upgrade tournament to address some XSS vulnerabilities (#10277) # Conflicts: # packages/cli/src/Server.ts
Got released with |
https://linear.app/n8n/issue/PAY-1800