Fake repo examplesΒΆ
This project contains a documented example in docs/examples-repo/index.md.
Recommended reading order:
Product commands and models.
Use cases with
RuleandCompute.Custom repository contract and SQLAlchemy implementation.
Interface declaration and route wiring.
Integration tests that validate end-to-end behavior using these examples.
These examples are the reference implementation for DSL usage and expected behavior.
Useful files:
tests/integration/fake_repo/product/repository_contract.pytests/integration/fake_repo/product/repository.pytests/integration/fake_repo/src/app/product/use_cases.pytests/integration/core/use_case/test_use_case_crud_integration.pytests/integration/core/use_case/test_custom_repository_integration.py
Custom repository pattern:
Declare the custom contract as
RepoFor[Model]plus only the extra methods.Register the SQLAlchemy implementation with
@repository_for(Model, contract=...).Keep CRUD-only use cases on
self.main_repo; they automatically receive the custom implementation.Reserve constructor-injected repository contracts for advanced cases where a use case or job needs a secondary repository dependency; the primary public example should stay on
main_repo.