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

Rename repository methods to use store/fetch/update/remove #19

Merged
merged 9 commits into from
Jul 19, 2024

Conversation

karlhigley
Copy link
Collaborator

@karlhigley karlhigley commented Jul 17, 2024

We talked about this change recently in a few different conversations, so I went ahead and put it together. These methods are basically CRUD, but the semantics of create/read/update/delete aren't quite right here. Since our domain objects aren't coupled to the underlying storage technologies, we can create an account with the normal Python constructor Account(email=...) without storing it anywhere and then decide where/how to store it. This should really come in handy with some of our upcoming data export work, because it will mean that we can create e.g. id mapping objects that are never stored in the database but instead written to files while maintaining an easy path for importing them into the database.

It also opens up a possibility for testing our platform code without the database, which is that we can use an InMemoryWhateverRepository class (potentially from this repo) that has all the same methods and does all the same things but just holds the objects in memory instead of storing them anywhere. In this repo, we can test that the Db/S3/InMemory implementations are interchangeable, and in poprox-platform we can then avoid having to create mocks for the Db/S3 repositories or stub their individual methods but still be able to test that the platform code works the way we expect without involving a database or S3.

@karlhigley karlhigley requested a review from kluver July 17, 2024 15:36
@karlhigley karlhigley self-assigned this Jul 17, 2024
Copy link
Contributor

@kluver kluver left a comment

Choose a reason for hiding this comment

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

Looking good. I think fetch and store match the semantics a lot better.

@kluver
Copy link
Contributor

kluver commented Jul 19, 2024

I'm working on resolving conflicts right now.

@kluver kluver merged commit e102e0e into main Jul 19, 2024
2 checks passed
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.

2 participants