Improve the production frontend
This commit is contained in:
@@ -46,15 +46,20 @@ async def get_dashboard_summary(
|
||||
):
|
||||
"""Get production dashboard summary using shared auth"""
|
||||
try:
|
||||
# Extract tenant from user context for security
|
||||
current_tenant = current_user.get("tenant_id")
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
summary = await production_service.get_dashboard_summary(tenant_id)
|
||||
|
||||
logger.info("Retrieved production dashboard summary",
|
||||
|
||||
logger.info("Retrieved production dashboard summary",
|
||||
tenant_id=str(tenant_id), user_id=current_user.get("user_id"))
|
||||
|
||||
|
||||
return summary
|
||||
|
||||
|
||||
except Exception as e:
|
||||
logger.error("Error getting production dashboard summary",
|
||||
logger.error("Error getting production dashboard summary",
|
||||
error=str(e), tenant_id=str(tenant_id))
|
||||
raise HTTPException(status_code=500, detail="Failed to get dashboard summary")
|
||||
|
||||
@@ -68,6 +73,7 @@ async def get_daily_requirements(
|
||||
):
|
||||
"""Get daily production requirements"""
|
||||
try:
|
||||
current_tenant = current_user.get("tenant_id")
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
@@ -94,6 +100,7 @@ async def get_production_requirements(
|
||||
):
|
||||
"""Get production requirements for procurement planning"""
|
||||
try:
|
||||
current_tenant = current_user.get("tenant_id")
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
@@ -124,6 +131,7 @@ async def create_production_batch(
|
||||
):
|
||||
"""Create a new production batch"""
|
||||
try:
|
||||
current_tenant = current_user.get("tenant_id")
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
@@ -151,6 +159,7 @@ async def get_active_batches(
|
||||
):
|
||||
"""Get currently active production batches"""
|
||||
try:
|
||||
current_tenant = current_user.get("tenant_id")
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
@@ -185,6 +194,7 @@ async def get_batch_details(
|
||||
):
|
||||
"""Get detailed information about a production batch"""
|
||||
try:
|
||||
current_tenant = current_user.get("tenant_id")
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
@@ -218,6 +228,7 @@ async def update_batch_status(
|
||||
):
|
||||
"""Update production batch status"""
|
||||
try:
|
||||
current_tenant = current_user.get("tenant_id")
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
@@ -253,6 +264,7 @@ async def get_production_schedule(
|
||||
):
|
||||
"""Get production schedule for a date range"""
|
||||
try:
|
||||
current_tenant = current_user.get("tenant_id")
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
@@ -316,6 +328,7 @@ async def get_capacity_status(
|
||||
):
|
||||
"""Get production capacity status for a specific date"""
|
||||
try:
|
||||
current_tenant = current_user.get("tenant_id")
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
@@ -353,6 +366,7 @@ async def get_yield_metrics(
|
||||
):
|
||||
"""Get production yield metrics for analysis"""
|
||||
try:
|
||||
current_tenant = current_user.get("tenant_id")
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user