feat: profit table and division of charts in statistics

This commit is contained in:
2024-11-17 00:59:36 +04:00
parent 3453c394e5
commit 3dbbae2173
5 changed files with 324 additions and 69 deletions

View File

@@ -4,7 +4,8 @@ from fastapi import APIRouter, Depends
from sqlalchemy.ext.asyncio import AsyncSession
from backend.session import get_session
from schemas.statistics import GetProfitDataRequest, GetProfitDataResponse
from schemas.statistics import GetProfitChartDataRequest, GetProfitChartDataResponse, GetProfitTableDataResponse, \
GetProfitTableDataRequest
from services.auth import authorized_user
from services.statistics import StatisticsService
@@ -16,12 +17,24 @@ statistics_router = APIRouter(
@statistics_router.post(
'/get-profit-data',
response_model=GetProfitDataResponse,
operation_id='get_profit_data',
'/get-profit-chart-data',
response_model=GetProfitChartDataResponse,
operation_id='get_profit_chart_data',
)
async def get_profit_data(
async def get_profit_chart_data(
session: Annotated[AsyncSession, Depends(get_session)],
request: GetProfitDataRequest
request: GetProfitChartDataRequest
):
return await StatisticsService(session).get_profit_data(request)
return await StatisticsService(session).get_profit_chart_data(request)
@statistics_router.post(
'/get-profit-table-data',
response_model=GetProfitTableDataResponse,
operation_id='get_profit_table_data',
)
async def get_profit_table_data(
session: Annotated[AsyncSession, Depends(get_session)],
request: GetProfitTableDataRequest
):
return await StatisticsService(session).get_profit_table_data(request)