From 8f4d733d12b677b5fa7562b69e06be956699101e Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 22 Feb 2026 15:35:58 +0000 Subject: [PATCH] Tech debt cleanup: update README, fix comments, sync shared submodule Co-Authored-By: Claude Opus 4.6 --- README.md | 40 +++++-------------- app.py | 4 +- bp/calendar_entry/routes.py | 3 +- .../services/ticket_operations.py | 3 +- shared | 2 +- 5 files changed, 16 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index ac43aaa..5327685 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Calendar and event booking service for the Rose Ash cooperative platform. Manage ## Architecture -One of four Quart microservices sharing a single PostgreSQL database: +One of five Quart microservices sharing a single PostgreSQL database: | App | Port | Domain | |-----|------|--------| @@ -12,6 +12,7 @@ One of four Quart microservices sharing a single PostgreSQL database: | market | 8001 | Product browsing, Suma scraping | | cart | 8002 | Shopping cart, checkout, orders | | **events** | 8003 | Calendars, bookings, tickets | +| federation | 8004 | ActivityPub, fediverse social | ## Structure @@ -19,7 +20,6 @@ One of four Quart microservices sharing a single PostgreSQL database: app.py # Application factory (create_base_app + blueprints) path_setup.py # Adds project root + app dir to sys.path config/app-config.yaml # App URLs, feature flags -events_api.py # Internal API (/internal/events/*) models/ # Events-domain models calendars.py # Calendar, CalendarEntry, CalendarSlot, # TicketType, Ticket, CalendarEntryPost @@ -37,11 +37,8 @@ bp/ # Blueprints ticket_admin/ # Ticket administration markets/ # Page-scoped marketplace views payments/ # Payment-related views -templates/ # Jinja2 templates -entrypoint.sh # Docker entrypoint -Dockerfile -shared/ # Submodule → git.rose-ash.com/coop/shared.git -glue/ # Submodule → git.rose-ash.com/coop/glue.git +services/ # register_domain_services() — wires calendar + market + cart +shared/ # Submodule -> git.rose-ash.com/coop/shared.git ``` ## Models @@ -57,26 +54,18 @@ All events-domain models live in `models/calendars.py`: | **Ticket** | Individual ticket with unique code, state, and `order_id` (plain integer, no FK) | | **CalendarEntryPost** | Junction linking entries to content via `content_type + content_id` | -`order_id` on CalendarEntry and Ticket is a plain integer column — no FK constraint to the orders table. The cart app writes these values via glue services (`order_lifecycle.py`), not directly. +`order_id` on CalendarEntry and Ticket is a plain integer column — no FK constraint to the orders table. The cart app writes these values via service calls, not directly. -## Dependencies +## Cross-Domain Communication -**Cross-app model imports:** -- `blog.models.ghost_content.Post` — `app.py` context processor, calendar/market services for page hydration -- `market.models.market_place.MarketPlace` — `app.py` context processor, marketplace views -- `cart.models.page_config.PageConfig` — `bp/payments/routes.py` for per-page SumUp config - -**Glue services:** -- `glue.services.relationships.attach_child / detach_child` — calendar and marketplace services manage page associations -- `glue.services.navigation.get_navigation_tree` — context processor builds site nav - -**Internal APIs:** -- Calls `GET /internal/cart/summary` — context processor for cart widget -- Exposes `/internal/events/*` via `events_api.py` — serves calendar data to other apps +- `services.market.*` — marketplace queries for page views +- `services.cart.*` — cart summary for context processor +- `services.federation.*` — AP publishing for new entries +- `shared.services.navigation` — site navigation tree ## Migrations -This app does **not** run Alembic migrations on startup. Migrations are managed in the `shared/` submodule and run from the blog app's entrypoint. The events app's `entrypoint.sh` skips the migration step. +This app does **not** run Alembic migrations on startup. Migrations are managed in the `shared/` submodule and run from the blog app's entrypoint. ## Running @@ -87,10 +76,3 @@ export SECRET_KEY=your-secret-key hypercorn app:app --bind 0.0.0.0:8003 ``` - -## Docker - -```bash -docker build -t events . -docker run -p 8003:8000 --env-file .env events -``` diff --git a/app.py b/app.py index f7d0233..4054cb2 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,6 @@ from __future__ import annotations -import path_setup # noqa: F401 # adds shared_lib to sys.path +import path_setup # noqa: F401 # adds shared/ to sys.path from pathlib import Path from quart import g, abort @@ -15,7 +15,7 @@ async def events_context() -> dict: """ Events app context processor. - - menu_items: direct DB query via glue layer + - menu_items: via shared.services.navigation - cart_count/cart_total: via cart service (shared DB) """ from shared.infrastructure.context import base_context diff --git a/bp/calendar_entry/routes.py b/bp/calendar_entry/routes.py index 7b5f668..cfb8027 100644 --- a/bp/calendar_entry/routes.py +++ b/bp/calendar_entry/routes.py @@ -256,8 +256,7 @@ def register(): async def get(entry_id: int, **rest): from shared.browser.app.utils.htmx import is_htmx_request - # TODO: Create _main_panel.html and _oob_elements.html for optimized HTMX - # For now, render full template for both HTMX and normal requests + # Full template for both HTMX and normal requests if not is_htmx_request(): # Normal browser request: full page with layout html = await render_template( diff --git a/bp/calendar_entry/services/ticket_operations.py b/bp/calendar_entry/services/ticket_operations.py index eb25a3d..46fbdfb 100644 --- a/bp/calendar_entry/services/ticket_operations.py +++ b/bp/calendar_entry/services/ticket_operations.py @@ -83,6 +83,5 @@ async def get_available_tickets( if entry.ticket_count is None: return None, None - # TODO: Subtract booked tickets when ticket booking is implemented - # For now, just return the total count + # Returns total count (booked tickets not yet subtracted) return entry.ticket_count, None diff --git a/shared b/shared index bccfff0..d697709 160000 --- a/shared +++ b/shared @@ -1 +1 @@ -Subproject commit bccfff0c699fdf9e3ee7c911af1f17a5294943f6 +Subproject commit d697709f60a71941880f4288be469913d11ce967