-
Notifications
You must be signed in to change notification settings - Fork 111
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
Add username to get account #265
base: main
Are you sure you want to change the base?
Add username to get account #265
Conversation
type AccountGetterParams struct { | ||
AccountID *int | ||
Username *string | ||
} | ||
|
||
func AccountGetter(store data.AccountStore, params AccountGetterParams) (*models.Account, error) { |
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.
Haven't seen structs used for params, so let me know if this should be changed
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.
Hi @ahme-dev, thanks for your patience. This looks good! I have one small question before I'm ready to approve.
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.
Thanks @ahme-dev
@ahme-dev Would you take a look at the failed tests in https://github.com/keratin/authn-server/actions/runs/13155722367/job/36867948456?pr=265? I believe the failed lint is a different issue. |
@@ -32,7 +32,7 @@ func PrivateRoutes(app *app.App) []*route.HandledRoute { | |||
SecuredWith(authentication). | |||
Handle(handlers.PostAccountsImport(app)), | |||
|
|||
route.Get("/accounts/{id:[0-9]+}"). | |||
route.Get("/accounts/{id}"). |
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.
@cainlevy, one of the tests (for available account) fails because this overrides the public route "/accounts/available". Any suggestions to work around this? Can't use the older [0-9] since it rejects accept emails. I think we ideally want to put the overriden route above this route definition, but being in separate files, it might be difficult.
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.
Oh yes that is awkward.
I think it's worth trying to register public routes before private routes to fix this. It sounds like the test case, as written, will ensure it remains that way. If we later run into a new issue that implies a need to reverse the order again, we'll find a new kind of solution.
Adds the ability to get an account by username, alongside the normal id. As discussed in #264