Cart rendering, bug fixes with cart adding/rming
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user