feat: decouple market from shared_lib, add app-owned models
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>
This commit is contained in:
@@ -15,8 +15,8 @@ from ..browse.services.slugs import canonical_html_slug
|
||||
from ..browse.services.blacklist.product import is_product_blocked
|
||||
from ..browse.services import db_backend as cb
|
||||
from ..browse.services import _massage_product
|
||||
from utils import host_url
|
||||
from suma_browser.app.redis_cacher import cache_page, clear_cache
|
||||
from shared.utils import host_url
|
||||
from shared.browser.app.redis_cacher import cache_page, clear_cache
|
||||
from ..cart.services import total
|
||||
from .services.product_operations import toggle_product_like, massage_full_product
|
||||
|
||||
@@ -94,7 +94,7 @@ def register():
|
||||
@bp.get("/")
|
||||
@cache_page(tag="browse")
|
||||
async def product_detail(slug: str):
|
||||
from suma_browser.app.utils.htmx import is_htmx_request
|
||||
from shared.browser.app.utils.htmx import is_htmx_request
|
||||
|
||||
# Determine which template to use based on request type
|
||||
if not is_htmx_request():
|
||||
@@ -136,11 +136,11 @@ def register():
|
||||
)
|
||||
return html
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@bp.get("/admin/")
|
||||
async def admin(slug: str):
|
||||
from suma_browser.app.utils.htmx import is_htmx_request
|
||||
from shared.browser.app.utils.htmx import is_htmx_request
|
||||
|
||||
if not is_htmx_request():
|
||||
# Normal browser request: full page with layout
|
||||
@@ -152,8 +152,8 @@ def register():
|
||||
return await make_response(html)
|
||||
|
||||
|
||||
from suma_browser.app.bp.cart.services.identity import current_cart_identity
|
||||
#from suma_browser.app.bp.cart.routes import view_cart
|
||||
from bp.cart.services.identity import current_cart_identity
|
||||
#from bp.cart.routes import view_cart
|
||||
from models.market import CartItem
|
||||
from quart import request, url_for
|
||||
|
||||
@@ -242,7 +242,7 @@ def register():
|
||||
)
|
||||
|
||||
# normal POST: go to cart page
|
||||
from shared.urls import cart_url
|
||||
from shared.infrastructure.urls import cart_url
|
||||
return redirect(cart_url("/"))
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ def massage_full_product(product: Product) -> dict:
|
||||
Convert a Product ORM model to a dictionary with all fields.
|
||||
Used for rendering product detail pages.
|
||||
"""
|
||||
from suma_browser.app.bp.browse.services import _massage_product
|
||||
from bp.browse.services import _massage_product
|
||||
|
||||
gallery = []
|
||||
if product.image:
|
||||
|
||||
Reference in New Issue
Block a user