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 handling of stores #392

Merged
merged 9 commits into from
Sep 20, 2020
Merged

Refactor handling of stores #392

merged 9 commits into from
Sep 20, 2020

Conversation

danschultzer
Copy link
Collaborator

@danschultzer danschultzer commented Jan 22, 2020

In #386 an Ecto backend store is discussed, and I believe that it should be easier to handle it as association to user. I want to make the stores just pass on the user struct to the backend store instead of doing any transformations on the user.

With this setup, in persistent session store it would be essential to reload the user, so I've added an additional method to Pow.Operations that can convert a struct into a get clauses so it can be used in get_by. Not sure about the name of the method, but the approach feels right.

In this case both Ecto and Phoenix modules will rely on Pow.Operations as the way to convert back and fourth. I've thought of maybe having just a reload method in Pow.Operations instead, but the get clauses are necessary for Pow.Store.CredentialsCache to construct a key.

This PR DRYs up a few things as well. I'll have to give this some more thought, as I'm thinking that I should maybe commit smaller bits of this first.

Resolves #563

@danschultzer danschultzer marked this pull request as ready for review September 20, 2020 19:32
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.

Load the user from the database each time it's fetched from the cache by default
1 participant