refactor: move transaction management from services to API endpoints
- Services now use db.flush() instead of db.commit() for database operations - API endpoints handle transaction commit after service calls - Remove db.rollback() from services (let exception handlers manage this) - Ensures consistent transaction boundaries at API layer This pattern gives API endpoints full control over when to commit, allowing for better error handling and potential multi-operation transactions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1
app/api/v1/vendor/orders.py
vendored
1
app/api/v1/vendor/orders.py
vendored
@@ -106,6 +106,7 @@ def update_order_status(
|
||||
order_id=order_id,
|
||||
order_update=order_update,
|
||||
)
|
||||
db.commit()
|
||||
|
||||
logger.info(
|
||||
f"Order {order.order_number} status updated to {order.status} "
|
||||
|
||||
Reference in New Issue
Block a user