Skip to content

Logic flow consistency - #2135

Open
bfoley12 wants to merge 28 commits into
devfrom
logic-flow-consistency
Open

Logic flow consistency#2135
bfoley12 wants to merge 28 commits into
devfrom
logic-flow-consistency

Conversation

@bfoley12

@bfoley12 bfoley12 commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Previously, some routers talked to the service AND the repo, and the repo knew a lot about the broader domain and business logic. This branch strengthened the relationships and clarified the boundaries. Routers now exclusively call service methods, which know about domain models and how they relate, as well as the shape of the domain repo. The repo exposes thin (when possible) methods for interacting with the underlying DB.

Major changes:

  • All routers now only call to the related service instead of repos
  • All repos are more focused on pure database interactions
    • Most business logic now lives in the service layer
    • Methods now expect Documents rather than DocumentIn
  • Scope transitioned from a per-repo _build_scope method to a declarative Policy pattern
    • See scope.py

The previous commit referenced this too. I think that one was for project-groups
…cope) to a Policy pattern

each repo still declares scope, but the creation of the scope is handled through a single Policy pattern in scope.py
…c into the service

Repositories should be thin interfaces into the MongoDB collection, not deciding ownership, managing server-owned fields, etc.
…ative from all projects referencing it

prevents dangling references after removing an Initiative
repos only need user info to set a scope, not persistently
…nt with the MongoDb<Resource>Repository form
…s into a single 'count_matching' method

uses pymongo directly to allow flexible queries. Can be scoped to a user or global
…ons' as useless forward

service now relies on the MongoDbRepository.download directly
db tests were still relying on old function declarations.
…ports successes/failures as BulkWriteSummary
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.

1 participant