updates
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"filename": "backup_luxury_hotel_db_20251210_000027.sql",
|
||||
"path": "backups/backup_luxury_hotel_db_20251210_000027.sql",
|
||||
"size_bytes": 462323,
|
||||
"size_mb": 0.44,
|
||||
"created_at": "2025-12-10T00:00:28.460311",
|
||||
"database": "luxury_hotel_db",
|
||||
"status": "success"
|
||||
}
|
||||
4907
Backend/backups/backup_luxury_hotel_db_20251210_000027.sql
Normal file
4907
Backend/backups/backup_luxury_hotel_db_20251210_000027.sql
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -3,6 +3,7 @@ Approval workflow routes.
|
||||
"""
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy.exc import ProgrammingError
|
||||
from typing import Optional
|
||||
from ...shared.config.database import get_db
|
||||
from ...shared.config.logging_config import get_logger
|
||||
@@ -57,6 +58,13 @@ async def get_pending_approvals(
|
||||
})
|
||||
except HTTPException:
|
||||
raise
|
||||
except ProgrammingError as e:
|
||||
# Handle missing table gracefully
|
||||
if "doesn't exist" in str(e) and "approval_requests" in str(e):
|
||||
logger.warning('Approval requests table does not exist. Returning empty list. Run migrations to create the table.')
|
||||
return success_response(data={'approvals': []})
|
||||
logger.error(f'Database error getting pending approvals: {str(e)}', exc_info=True)
|
||||
raise HTTPException(status_code=500, detail='Database error occurred')
|
||||
except Exception as e:
|
||||
logger.error(f'Error getting pending approvals: {str(e)}', exc_info=True)
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
@@ -88,6 +96,12 @@ async def approve_request(
|
||||
)
|
||||
except ValueError as e:
|
||||
raise HTTPException(status_code=400, detail=str(e))
|
||||
except ProgrammingError as e:
|
||||
if "doesn't exist" in str(e) and "approval_requests" in str(e):
|
||||
logger.warning('Approval requests table does not exist. Run migrations to create the table.')
|
||||
raise HTTPException(status_code=503, detail='Approval system not available. Please run database migrations.')
|
||||
logger.error(f'Database error approving request: {str(e)}', exc_info=True)
|
||||
raise HTTPException(status_code=500, detail='Database error occurred')
|
||||
except Exception as e:
|
||||
logger.error(f'Error approving request: {str(e)}', exc_info=True)
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
@@ -118,6 +132,12 @@ async def reject_request(
|
||||
)
|
||||
except ValueError as e:
|
||||
raise HTTPException(status_code=400, detail=str(e))
|
||||
except ProgrammingError as e:
|
||||
if "doesn't exist" in str(e) and "approval_requests" in str(e):
|
||||
logger.warning('Approval requests table does not exist. Run migrations to create the table.')
|
||||
raise HTTPException(status_code=503, detail='Approval system not available. Please run database migrations.')
|
||||
logger.error(f'Database error rejecting request: {str(e)}', exc_info=True)
|
||||
raise HTTPException(status_code=500, detail='Database error occurred')
|
||||
except Exception as e:
|
||||
logger.error(f'Error rejecting request: {str(e)}', exc_info=True)
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
@@ -162,6 +182,12 @@ async def get_my_approval_requests(
|
||||
})
|
||||
except HTTPException:
|
||||
raise
|
||||
except ProgrammingError as e:
|
||||
if "doesn't exist" in str(e) and "approval_requests" in str(e):
|
||||
logger.warning('Approval requests table does not exist. Returning empty list. Run migrations to create the table.')
|
||||
return success_response(data={'approvals': []})
|
||||
logger.error(f'Database error getting user approvals: {str(e)}', exc_info=True)
|
||||
raise HTTPException(status_code=500, detail='Database error occurred')
|
||||
except Exception as e:
|
||||
logger.error(f'Error getting user approvals: {str(e)}', exc_info=True)
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
@@ -194,6 +220,12 @@ async def cancel_approval_request(
|
||||
return success_response(message='Approval request cancelled successfully')
|
||||
except HTTPException:
|
||||
raise
|
||||
except ProgrammingError as e:
|
||||
if "doesn't exist" in str(e) and "approval_requests" in str(e):
|
||||
logger.warning('Approval requests table does not exist. Run migrations to create the table.')
|
||||
raise HTTPException(status_code=503, detail='Approval system not available. Please run database migrations.')
|
||||
logger.error(f'Database error cancelling approval request: {str(e)}', exc_info=True)
|
||||
raise HTTPException(status_code=500, detail='Database error occurred')
|
||||
except Exception as e:
|
||||
logger.error(f'Error cancelling approval request: {str(e)}', exc_info=True)
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
Reference in New Issue
Block a user