You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
812 B
25 lines
812 B
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from api.request.analytics import AnalyticsFilters
|
|
from api.response.analytics import ResponseAnalyticsFactory, ResponseAnalytics
|
|
from db.models.conveer import DBConveer
|
|
from managers.analytics import AnalyticsManager
|
|
from server.depends import get_session
|
|
|
|
router = APIRouter(prefix="/api/analytics", tags=['Ride'])
|
|
|
|
|
|
@router.post('/all', response_model=ResponseAnalytics)
|
|
async def get_all_analytics(
|
|
filters: AnalyticsFilters,
|
|
session: AsyncSession = Depends(get_session),
|
|
):
|
|
data: list[DBConveer] = await AnalyticsManager.get_by_filters(
|
|
session=session,
|
|
start_date=filters.start_time,
|
|
end_date=filters.end_time
|
|
)
|
|
|
|
return ResponseAnalyticsFactory.get_from_models(models=data)
|