Refactor to chained DI, migrate to uv, add vehicles router#2
Open
adamontherun wants to merge 7 commits intomainfrom
Open
Refactor to chained DI, migrate to uv, add vehicles router#2adamontherun wants to merge 7 commits intomainfrom
adamontherun wants to merge 7 commits intomainfrom
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
- database.py: lazy get_engine() so unit tests need no DATABASE_URL - main.py: load_dotenv() at top so uvicorn loads .env - test_create_character_invalid_data: override CharactersService to avoid DB chain - tests/integration_tests/conftest.py: sync integration_client with transaction rollback - Integration tests use integration_client fixture - README: DI chain, testing strategy, uv setup (no async references) Co-authored-by: Cursor <cursoragent@cursor.com>
- main.py: include vehicles_router, wire SwapiVehicleError and vehicle_not_found_error_handler - StarWarsVehicleCreate: require only name (matches character pattern, service fetches from SWAPI) - StarWarsVehicleRead: optional fields, remove pilots (never populated) - SwapiVehicle: optional fields for SWAPI response parsing Co-authored-by: Cursor <cursoragent@cursor.com>
…omain, utils The DI chain rewrite dropped context about Pydantic schemas, SQLAlchemy models, networking clients, domain logic, and utils. Added it back as a compact section between project layout and naming. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Depends(). Router tests override the service; service tests inject a mock DB client; DB client tests inject a mock session.requirements.txtwithpyproject.tomlanduv sync.DATABASE_URL. Integration tests use a real Postgres session with transaction rollback.load_dotenv()inmain.pysouvicornloads.env.vehicles_router, fixedSwapiVehicleErrorandVehicleNotFoundErrorhandlers, simplified vehicle schemas to match the character pattern (create needs onlyname).