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

feat(database): add user management routes #365

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

curzolapierre
Copy link
Member

@curzolapierre curzolapierre commented Nov 13, 2023

@curzolapierre curzolapierre self-assigned this Nov 13, 2023
@curzolapierre curzolapierre marked this pull request as ready for review November 13, 2023 15:48
Copy link
Contributor

@yohann-bacha yohann-bacha left a comment

Choose a reason for hiding this comment

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

I only have a question concerning the confirmation field, but otherwise lgtm

Name string `json:"name"`
ReadOnly bool `json:"read_only"`
Password string `json:"password,omitempty"`
PasswordConfirmation string `json:"password_confirmation,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

question: well, i know that the api doc specifies that we wait for a password confirmation, but in fact appsdeck-database does not receives this param. are you sure this field is really used?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is a required param from the DB-API

@curzolapierre curzolapierre merged commit f6d003f into master Nov 14, 2023
1 check passed
@curzolapierre curzolapierre deleted the feat/cli/1018/db_user_management branch November 14, 2023 11:09
res := DatabaseUsersResponse{}
err := c.DBAPI(app, addonID).SubresourceList(ctx, "databases", addonID, "users", nil, &res)
if err != nil {
return res.DatabaseUsers, errors.Wrap(ctx, err, "get database list of users")
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi there,
I noticed that you now use errors.Wrap instead of errgo.Notef elsewhere in the code. Is it expected ? This require a little bit of work when using theses endpoints when there is an error (and create some headache).

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi François,
We depreciate the usage of the package errgo in general in favor of errors. This latter is not from standard library, because it doesn't implement wrapping system yet.
But you have probably noticed that it's not the latter package itself that is used here and more generally in our code base.

We are wrapping these two first packages to be retro compatible during the transition and to take context (ErrCtx) by using our own package: "github.com/Scalingo/go-utils/errors/v2".

If by little bit of work you mean compare errors. I'd strongly advise you to use Is and/or As methods from ErrCtx, you can find them here:
https://github.com/Scalingo/go-utils/blob/77ec9e608897147630a4e56912c9318aa3d4c692/errors/cause.go#L10-L38
Their behavior is based on standard library.

FYI taking the context allows us to retrieve the root logger containing all fields, e.g. in middlewares.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants