All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 44s
Replace direct Post, Calendar, CalendarEntry model queries and glue lifecycle imports with typed service calls. Cart registers all 4 services via domain_services_fn with has() guards. Key changes: - app.py: use domain_services_fn, Post query → services.blog - api.py: Calendar/CalendarEntry → services.calendar - checkout: glue order_lifecycle → services.calendar.claim/confirm - calendar_cart: CalendarEntry → services.calendar.pending_entries() - page_cart: Post/Calendar queries → services.blog/calendar - global_routes: glue imports → service calls Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
702 B
Python
29 lines
702 B
Python
from __future__ import annotations
|
|
|
|
from shared.services.registry import services
|
|
from .identity import current_cart_identity
|
|
|
|
|
|
async def get_calendar_cart_entries(session):
|
|
"""
|
|
Return all *pending* calendar entries (as CalendarEntryDTOs) for the
|
|
current cart identity (user or anonymous session).
|
|
"""
|
|
ident = current_cart_identity()
|
|
return await services.calendar.pending_entries(
|
|
session,
|
|
user_id=ident["user_id"],
|
|
session_id=ident["session_id"],
|
|
)
|
|
|
|
|
|
def calendar_total(entries) -> float:
|
|
"""
|
|
Total cost of pending calendar entries.
|
|
"""
|
|
return sum(
|
|
(e.cost or 0)
|
|
for e in entries
|
|
if e.cost is not None
|
|
)
|