mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-06-23 18:21:13 +00:00
feat: stage3 — REST API endpoints and dummy FlightProcessor
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""FastAPI Dependencies."""
|
||||
|
||||
from collections.abc import AsyncGenerator
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from gps_denied.core.processor import FlightProcessor
|
||||
from gps_denied.db.engine import get_session
|
||||
from gps_denied.db.repository import FlightRepository
|
||||
|
||||
|
||||
async def get_repository(session: AsyncSession = Depends(get_session)) -> FlightRepository:
|
||||
return FlightRepository(session)
|
||||
|
||||
|
||||
async def get_flight_processor(
|
||||
repo: FlightRepository = Depends(get_repository),
|
||||
) -> FlightProcessor:
|
||||
return FlightProcessor(repo)
|
||||
|
||||
|
||||
# Type aliases for cleaner router definitions
|
||||
SessionDep = Annotated[AsyncSession, Depends(get_session)]
|
||||
RepoDep = Annotated[FlightRepository, Depends(get_repository)]
|
||||
ProcessorDep = Annotated[FlightProcessor, Depends(get_flight_processor)]
|
||||
Reference in New Issue
Block a user