Add frontend imporvements 2

This commit is contained in:
Urtzi Alfaro
2025-09-09 22:27:52 +02:00
parent 2a05048912
commit aff644d793
6 changed files with 32 additions and 30 deletions

View File

@@ -31,7 +31,7 @@ from app.schemas.dashboard import (
logger = structlog.get_logger()
router = APIRouter(prefix="/dashboard", tags=["dashboard"])
router = APIRouter(tags=["dashboard"])
# ===== Dependency Injection =====
@@ -46,7 +46,7 @@ async def get_dashboard_service(db: AsyncSession = Depends(get_db)) -> Dashboard
# ===== Main Dashboard Endpoints =====
@router.get("/tenants/{tenant_id}/summary", response_model=InventoryDashboardSummary)
@router.get("/tenants/{tenant_id}/dashboard/summary", response_model=InventoryDashboardSummary)
async def get_inventory_dashboard_summary(
tenant_id: UUID = Path(...),
filters: Optional[DashboardFilter] = None,
@@ -74,7 +74,7 @@ async def get_inventory_dashboard_summary(
)
@router.get("/tenants/{tenant_id}/food-safety", response_model=FoodSafetyDashboard)
@router.get("/tenants/{tenant_id}/dashboard/food-safety", response_model=FoodSafetyDashboard)
async def get_food_safety_dashboard(
tenant_id: UUID = Path(...),
current_user: dict = Depends(get_current_user_dep),
@@ -101,7 +101,7 @@ async def get_food_safety_dashboard(
)
@router.get("/tenants/{tenant_id}/analytics", response_model=InventoryAnalytics)
@router.get("/tenants/{tenant_id}/dashboard/analytics", response_model=InventoryAnalytics)
async def get_inventory_analytics(
tenant_id: UUID = Path(...),
days_back: int = Query(30, ge=1, le=365, description="Number of days to analyze"),
@@ -129,7 +129,7 @@ async def get_inventory_analytics(
)
@router.get("/tenants/{tenant_id}/business-model", response_model=BusinessModelInsights)
@router.get("/tenants/{tenant_id}/dashboard/business-model", response_model=BusinessModelInsights)
async def get_business_model_insights(
tenant_id: UUID = Path(...),
current_user: dict = Depends(get_current_user_dep),
@@ -158,7 +158,7 @@ async def get_business_model_insights(
# ===== Detailed Dashboard Data Endpoints =====
@router.get("/tenants/{tenant_id}/stock-status", response_model=List[StockStatusSummary])
@router.get("/tenants/{tenant_id}/dashboard/stock-status", response_model=List[StockStatusSummary])
async def get_stock_status_by_category(
tenant_id: UUID = Path(...),
current_user: dict = Depends(get_current_user_dep),
@@ -181,7 +181,7 @@ async def get_stock_status_by_category(
)
@router.get("/tenants/{tenant_id}/alerts-summary", response_model=List[AlertSummary])
@router.get("/tenants/{tenant_id}/dashboard/alerts-summary", response_model=List[AlertSummary])
async def get_alerts_summary(
tenant_id: UUID = Path(...),
filters: Optional[AlertsFilter] = None,
@@ -205,7 +205,7 @@ async def get_alerts_summary(
)
@router.get("/tenants/{tenant_id}/recent-activity", response_model=List[RecentActivity])
@router.get("/tenants/{tenant_id}/dashboard/recent-activity", response_model=List[RecentActivity])
async def get_recent_activity(
tenant_id: UUID = Path(...),
limit: int = Query(20, ge=1, le=100, description="Number of activities to return"),
@@ -234,7 +234,7 @@ async def get_recent_activity(
# ===== Real-time Data Endpoints =====
@router.get("/tenants/{tenant_id}/live-metrics")
@router.get("/tenants/{tenant_id}/dashboard/live-metrics")
async def get_live_metrics(
tenant_id: UUID = Path(...),
current_user: dict = Depends(get_current_user_dep),
@@ -261,7 +261,7 @@ async def get_live_metrics(
)
@router.get("/tenants/{tenant_id}/temperature-status")
@router.get("/tenants/{tenant_id}/dashboard/temperature-status")
async def get_temperature_monitoring_status(
tenant_id: UUID = Path(...),
current_user: dict = Depends(get_current_user_dep),
@@ -289,7 +289,7 @@ async def get_temperature_monitoring_status(
# ===== Dashboard Configuration Endpoints =====
@router.get("/tenants/{tenant_id}/config")
@router.get("/tenants/{tenant_id}/dashboard/config")
async def get_dashboard_config(
tenant_id: UUID = Path(...),
current_user: dict = Depends(get_current_user_dep)

View File

@@ -209,9 +209,9 @@ async def get_stock_entry(
@router.put("/tenants/{tenant_id}/stock/{stock_id}", response_model=StockResponse)
async def update_stock(
stock_data: StockUpdate,
stock_id: UUID = Path(..., description="Stock entry ID"),
tenant_id: UUID = Path(..., description="Tenant ID"),
stock_data: StockUpdate,
db: AsyncSession = Depends(get_db)
):
"""Update stock entry"""
@@ -269,8 +269,8 @@ async def delete_stock(
@router.post("/tenants/{tenant_id}/stock/movements", response_model=StockMovementResponse)
async def create_stock_movement(
tenant_id: UUID = Path(..., description="Tenant ID"),
movement_data: StockMovementCreate,
tenant_id: UUID = Path(..., description="Tenant ID"),
current_user: dict = Depends(get_current_user_dep),
db: AsyncSession = Depends(get_db)
):