Add users can see orders for their accounts

This commit is contained in:
2026-06-28 11:33:36 +02:00
parent ce75c52abe
commit 128b34e257

View File

@@ -139,7 +139,7 @@ async def get_order_details(
query = select(Order).where(Order.id == order_id)
order = session.scalars(query).one()
if user.id != order.user_id:
if order.transaction.account not in user.accounts:
raise HTTPException(
status_code=403, detail=f"User not authorized to view this order."
)