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

Model refactor, part 3 #4152

Merged
merged 11 commits into from
Oct 16, 2023
Merged

Conversation

DingDongSoLong4
Copy link
Collaborator

This is the last part of my model refactoring, mainly focusing on repositories:

  • 67725fb removes manager.Repository in favour of just models.Repository, and some cleanup around uses of txn.WithTxn and unnecessary Repository or txn.Manager function arguments or struct fields.
  • ea432c7 adds models.TxnManager to the various other Repository structs, and adds NewRepository functions to easily create those repositories from a models.Repository. Also more cleanup around usage of those repositories.
  • 2bff764 adds a mock Database struct for the entire database, which makes it easier to create and use the mock ReaderWriters.
  • d3bf97e adds an AssertExpectations utility method to the mock Database, which just calls AssertExpectations on all the ReaderWriters.
  • 40f37d9 adds a "parent" routes struct, adding a utility withReadTxn method for use with a request context.
  • 2941448 moves the default movie image from models to internal/static, and adds exported convenience functions to internal/static which panic if reading fails, since this should never happen.
  • And then e261ecb is just a minor refactor of the default performer image boxes in internal/api/images.go.

@WithoutPants WithoutPants added this to the Version 0.24.0 milestone Sep 25, 2023
@WithoutPants WithoutPants added the chore Pull requests for refactoring and admin work label Oct 16, 2023
@WithoutPants WithoutPants merged commit 33f2ebf into stashapp:develop Oct 16, 2023
2 checks passed
@DingDongSoLong4 DingDongSoLong4 deleted the model-refactor3 branch October 16, 2023 06:27
halkeye pushed a commit to halkeye/stash that referenced this pull request Sep 1, 2024
* Remove manager.Repository
* Refactor other repositories
* Fix tests and add database mock
* Add AssertExpectations method
* Refactor routes
* Move default movie image to internal/static and add convenience methods
* Refactor default performer image boxes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for refactoring and admin work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants