Skip to content

Logic flow consistency - #2135

Merged
bfoley12 merged 41 commits into
devfrom
logic-flow-consistency
Aug 25, 2026
Merged

Logic flow consistency#2135
bfoley12 merged 41 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
…oup to patch

previously, no check was performed on role
test whether actions can be taken on resources in various states from various users
…ervices are no longer concerned with identifier format
…ck on ProjectGroup.projects in a single request rather than multiple calls
…ncationalizing its purpose

ConsumerLimitsDep was used to get the limits associated with a user - something better expressed functionally
… instead of TIn to mirror general function signature

Moved the TIn -> TDoc coercion into the service layer
…-layers): Moved away from mixed REST (get, patch, put, etc.) towards CRUD (read, update, create, etc.)
@bfoley12
bfoley12 merged commit a015779 into dev Aug 25, 2026
5 checks passed
@bfoley12
bfoley12 deleted the logic-flow-consistency branch August 25, 2026 22:33
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