feat(backend): capture status and the stretches the archive was not recording
This commit is contained in:
1 parent
a0e134756c
commit
9ae8b34005
3 files changed
+78
No files matched your search
@@ -21,6 +21,7 @@ from api.routers import (
|
||||
avatars,
|
||||
backfill,
|
||||
bots,
|
||||
capture,
|
||||
chats,
|
||||
custom_emoji,
|
||||
discover,
|
||||
@@ -114,6 +115,7 @@ app.include_router(webhooks.router)
|
||||
app.include_router(shares.router)
|
||||
app.include_router(storage.router)
|
||||
app.include_router(files.router)
|
||||
app.include_router(capture.router)
|
||||
|
||||
app.mount("/mcp", mcp_app)
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
from datetime import datetime
|
||||
from typing import Annotated
|
||||
|
||||
import asyncpg
|
||||
from dishka.integrations.fastapi import DishkaRoute, FromDishka
|
||||
from fastapi import APIRouter, Query
|
||||
|
||||
from utils.read import capture
|
||||
from utils.read.models import CaptureGap, CaptureStatus
|
||||
|
||||
router = APIRouter(prefix="/api/capture", tags=["capture"], route_class=DishkaRoute)
|
||||
|
||||
AccountId = Annotated[int, Query()]
|
||||
|
||||
|
||||
@router.get("/status")
|
||||
async def capture_status(
|
||||
pool: FromDishka[asyncpg.Pool], account_id: AccountId
|
||||
) -> CaptureStatus:
|
||||
return await capture.capture_status(pool, account_id)
|
||||
|
||||
|
||||
@router.get("/gaps")
|
||||
async def capture_gaps(
|
||||
pool: FromDishka[asyncpg.Pool],
|
||||
account_id: AccountId,
|
||||
date_from: Annotated[datetime | None, Query()] = None,
|
||||
date_to: Annotated[datetime | None, Query()] = None,
|
||||
) -> list[CaptureGap]:
|
||||
return await capture.capture_gaps(
|
||||
pool, account_id, date_from=date_from, date_to=date_to
|
||||
)
|
||||
Reference in new issue
Block a user