feat(infra): add repository implementations, mappers, FastAPI wiring, and technique indexes
This commit is contained in:
30
backend/app/dependencies/repositories.py
Normal file
30
backend/app/dependencies/repositories.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""FastAPI dependency providers for repositories.
|
||||
|
||||
Wiring lives ONLY in the presentation layer — use cases and services
|
||||
never know which concrete repository implementation they receive.
|
||||
"""
|
||||
|
||||
from fastapi import Depends
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.database import get_db
|
||||
from app.infrastructure.persistence.repositories.sa_technique_repository import (
|
||||
SATechniqueRepository,
|
||||
)
|
||||
from app.infrastructure.persistence.repositories.sa_test_repository import (
|
||||
SATestRepository,
|
||||
)
|
||||
|
||||
|
||||
def get_technique_repository(
|
||||
db: Session = Depends(get_db),
|
||||
) -> SATechniqueRepository:
|
||||
"""Provide a TechniqueRepository backed by the current DB session."""
|
||||
return SATechniqueRepository(db)
|
||||
|
||||
|
||||
def get_test_repository(
|
||||
db: Session = Depends(get_db),
|
||||
) -> SATestRepository:
|
||||
"""Provide a TestRepository backed by the current DB session."""
|
||||
return SATestRepository(db)
|
||||
Reference in New Issue
Block a user