Cart rendering, bug fixes with cart adding/rming

This commit is contained in:
2026-02-08 19:15:48 +07:00
parent e8a61c05b3
commit 6409d66dfd
12 changed files with 252 additions and 38 deletions

View File

@@ -2,7 +2,9 @@ from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy import select
from typing import Optional
from db.models import Order, OrderStatus
from sqlalchemy.orm import selectinload
from db.models import Order, OrderStatus, OrderItem
class OrderRepository:
@@ -28,6 +30,7 @@ class OrderRepository:
.where(Order.customer == customer)
.where(Order.status == OrderStatus.DRAFT)
.limit(1)
.options(selectinload(Order.items).selectinload(OrderItem.product))
)
return await session.scalar(stmt)