feat: profit chart in statistics
This commit is contained in:
27
routers/statistics.py
Normal file
27
routers/statistics.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from backend.session import get_session
|
||||
from schemas.statistics import GetProfitDataRequest, GetProfitDataResponse
|
||||
from services.auth import authorized_user
|
||||
from services.statistics import StatisticsService
|
||||
|
||||
statistics_router = APIRouter(
|
||||
prefix="/statistics",
|
||||
tags=["statistics"],
|
||||
dependencies=[Depends(authorized_user)]
|
||||
)
|
||||
|
||||
|
||||
@statistics_router.post(
|
||||
'/get-profit-data',
|
||||
response_model=GetProfitDataResponse,
|
||||
operation_id='get_profit_data',
|
||||
)
|
||||
async def get_profit_data(
|
||||
session: Annotated[AsyncSession, Depends(get_session)],
|
||||
request: GetProfitDataRequest
|
||||
):
|
||||
return await StatisticsService(session).get_profit_data(request)
|
||||
Reference in New Issue
Block a user