Market context processor was only counting product CartItems for cart_count,
while blog/cart/events apps include calendar entries too. Use cart service
for consistent counts across all apps.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Market owns CartItem/Product — query directly with selectinload
so templates can access item.product.slug and other ORM attributes.
The cart service DTOs are for cross-domain consumers (blog, events).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The services singleton was used in before_request closures but the
import was removed when refactoring to domain_services_fn.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace direct Post query and CartItem imports with typed service calls.
Market registers all 4 services via domain_services_fn with has() guards.
Key changes:
- app.py: use domain_services_fn, Post query → services.blog,
CartItem → services.cart, MarketPlace+Post join → separate queries,
glue navigation → shared navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The context processor loaded cart items but only passed aggregates
(cart_count, cart_total) — not the cart list itself. Templates need
the full list to display per-product quantities.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two bugs fixed:
1. First htmx add didn't update mini cart count because the context
processor's API call couldn't see the uncommitted transaction.
Fix: pass cart_count/cart_total explicitly from the route handler.
2. Page refresh always showed cart count 0 because the internal API
call to the cart service failed to resolve cart identity correctly.
Fix: replace the API call with a direct DB query using the same
shared database and session, matching how the cart app itself works.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 1-3 of decoupling:
- path_setup.py adds project root to sys.path
- Market-owned models in market/models/ (market, market_place)
- All imports updated: shared.infrastructure, shared.db, shared.browser, etc.
- MarketPlace uses container_type/container_id instead of post_id FK
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The post header bar needs `post` in the template context to render
the page link, feature image, and nav. Added context processor to
spread g.post_data into templates, matching the events app pattern.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The market blueprint already uses <slug> for product routes,
so the app-level prefix uses <page_slug> instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Market app now follows the events app pattern — URLs include
the post slug prefix (e.g. /market/suma-market/). Hydrate
loads both post and market, verifying market belongs to post.
Scraper default URLs updated accordingly.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The url_prefix was being set both in register_market_bp() and
app.register_blueprint(), causing a SyntaxError from duplicate
route parameter.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Split from coop monolith. Includes:
- Market/browse/product blueprints
- Product sync API
- Suma scraping pipeline
- Templates for market, browse, and product views
- Dockerfile and CI workflow for independent deployment