feat: profit table and division of charts in statistics
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user