mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-04-23 00:26:36 +00:00
feat: stage4 — SSE event streamer and ResultManager
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
"""FastAPI Dependencies."""
|
||||
|
||||
from collections.abc import AsyncGenerator
|
||||
from typing import Annotated
|
||||
|
||||
@@ -7,18 +5,24 @@ from fastapi import Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from gps_denied.core.processor import FlightProcessor
|
||||
from gps_denied.core.sse import SSEEventStreamer
|
||||
from gps_denied.db.engine import get_session
|
||||
from gps_denied.db.repository import FlightRepository
|
||||
|
||||
# Singleton instance of SSE Event Streamer
|
||||
_sse_streamer = SSEEventStreamer()
|
||||
|
||||
def get_sse_streamer() -> SSEEventStreamer:
|
||||
return _sse_streamer
|
||||
|
||||
async def get_repository(session: AsyncSession = Depends(get_session)) -> FlightRepository:
|
||||
return FlightRepository(session)
|
||||
|
||||
|
||||
async def get_flight_processor(
|
||||
repo: FlightRepository = Depends(get_repository),
|
||||
sse: SSEEventStreamer = Depends(get_sse_streamer),
|
||||
) -> FlightProcessor:
|
||||
return FlightProcessor(repo)
|
||||
return FlightProcessor(repo, sse)
|
||||
|
||||
|
||||
# Type aliases for cleaner router definitions
|
||||
|
||||
Reference in New Issue
Block a user