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>
The _added.html template's summary macro expects calendar_total and
calendar_cart_entries from the cart/events domain. The market app has
no calendar entries, so pass a no-op function and empty list.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
g.cart was never populated in the market app — the cart loader
before_request hook was only registered in the cart microservice.
Replace the dead filter-building code with an actual query that
loads cart items inline, scoped to the current user/session.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
List specific model imports, glue services, and internal APIs
that market code actually references.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix microservice count (4 not 3), document submodules, models,
scraper, all blueprints including bp/cart/, and cross-app integration.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
shared: migration to drop cross-domain FK constraints
glue: order lifecycle services, cart adoption, login/order handlers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previous runs left self-copies (e.g. market/market/) that caused
'Table already defined' errors. Split into two loops: first rm -rf
all sibling dirs, then copy only non-self siblings.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Each app has its own models/ at the root (imported as bare `models.X`).
The CI copy was also creating {app}/models/ (imported as `{app}.models.X`),
causing SQLAlchemy to see the same table defined twice.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The cp approach failed when sibling repos were mid-update from
their own CI runs. git archive reads directly from git objects,
and git fetch ensures origin/decoupling is available even if the
sibling working tree is on a different branch.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phases 1-3 split models by domain ownership, but cross-app imports
still exist (e.g. cart imports market.models.CartItem). In Docker
each app only has its own code. The CI step now copies sibling app
model packages into the build context before docker build.
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>
market_url() generates URLs without the /<page_slug>/<market_slug>
prefix, causing 405 on POST /cart. url_for() auto-injects the slugs
via url_defaults.
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>
- Add post header row to market/index.html template chain
- Fix OOB templates to include post header on HTMX navigation
- Show market name instead of static coop_title in header
- Restore trailing slash on POST /cart/ route; fix templates to
include trailing slash in cart URLs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Templates generate URLs without trailing slash via market_url(), but
the route required one. POST requests don't get redirected by Werkzeug,
causing a 405 MethodNotAllowed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The market app doesn't have a cart blueprint registered, so url_for()
would fail. Uses the cross-app cart_url() helper instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Track which market a cart item came from by setting market_place_id
from g.market.id on new CartItem creation.
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>