Skip to content
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

Refactor credentials endpoints for user management #2688

Conversation

ivov
Copy link
Contributor

@ivov ivov commented Jan 17, 2022

  • POST /credentials
  • GET /credentials
  • GET /credentials/:id
  • PATCH /credentials/:id
  • DELETE /credentials/:id

Pinned chokidar to fix build: #2696

@ivov ivov added feature Large self-contained feature n8n team Authored by the n8n team labels Jan 17, 2022
@ivov ivov changed the base branch from master to user-management-backend January 17, 2022 09:11
packages/cli/src/Server.ts Outdated Show resolved Hide resolved
Comment on lines 1609 to 1611
if (!savedCredential) {
throw new ResponseHelper.ResponseError('Failed to save credential', undefined, 500);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if the transaction fails we anyway never reach this code 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a third way - returning a value inside the transaction makes it available in the outer scope. Otherwise TS would be unable to tell that savedCredential is not undefined after the transaction.

packages/cli/src/Server.ts Show resolved Hide resolved
packages/cli/src/Server.ts Show resolved Hide resolved
packages/cli/src/Server.ts Show resolved Hide resolved
packages/cli/src/Server.ts Show resolved Hide resolved
packages/cli/src/UserManagement/Interfaces.ts Show resolved Hide resolved
@BHesseldieck BHesseldieck merged commit 56bc4d0 into user-management-backend Jan 27, 2022
@BHesseldieck BHesseldieck deleted the user-management-backend-credentials-endpoints branch January 27, 2022 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Large self-contained feature n8n team Authored by the n8n team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants