Remove Calendar model import from checkout, use DTO fields
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 47s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 47s
resolve_page_config() now reads entry.calendar_container_id from the CalendarEntryDTO instead of fetching the Calendar ORM model. Fixes stale CalendarEntry type hints to CalendarEntryDTO. Updates shared submodule. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,10 +9,10 @@ from sqlalchemy.orm import selectinload
|
||||
|
||||
from shared.models.market import Product, CartItem
|
||||
from shared.models.order import Order, OrderItem
|
||||
from shared.models.calendars import Calendar
|
||||
from shared.models.page_config import PageConfig
|
||||
from shared.models.market_place import MarketPlace
|
||||
from shared.config import config
|
||||
from shared.contracts.dtos import CalendarEntryDTO
|
||||
from shared.events import emit_event
|
||||
from shared.services.registry import services
|
||||
|
||||
@@ -64,7 +64,7 @@ async def find_or_create_cart_item(
|
||||
async def resolve_page_config(
|
||||
session: AsyncSession,
|
||||
cart: list[CartItem],
|
||||
calendar_entries: list[CalendarEntry],
|
||||
calendar_entries: list[CalendarEntryDTO],
|
||||
) -> Optional["PageConfig"]:
|
||||
"""Determine the PageConfig for this order.
|
||||
|
||||
@@ -82,9 +82,8 @@ async def resolve_page_config(
|
||||
|
||||
# From calendar entries via calendar
|
||||
for entry in calendar_entries:
|
||||
cal = await session.get(Calendar, entry.calendar_id)
|
||||
if cal and cal.container_id:
|
||||
post_ids.add(cal.container_id)
|
||||
if entry.calendar_container_id:
|
||||
post_ids.add(entry.calendar_container_id)
|
||||
|
||||
if len(post_ids) > 1:
|
||||
raise ValueError("Cannot checkout items from multiple pages")
|
||||
@@ -105,7 +104,7 @@ async def resolve_page_config(
|
||||
async def create_order_from_cart(
|
||||
session: AsyncSession,
|
||||
cart: list[CartItem],
|
||||
calendar_entries: list[CalendarEntry],
|
||||
calendar_entries: list[CalendarEntryDTO],
|
||||
user_id: Optional[int],
|
||||
session_id: Optional[str],
|
||||
product_total: float,
|
||||
|
||||
2
shared
2
shared
Submodule shared updated: 9cba422aa9...b3a0e9922a
Reference in New Issue
Block a user