Tech debt cleanup: update README, fix comments, sync shared submodule
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 50s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-22 15:35:58 +00:00
parent e7e8d69b7a
commit 8f4d733d12
5 changed files with 16 additions and 36 deletions

View File

@@ -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
```

4
app.py
View File

@@ -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

View File

@@ -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(

View File

@@ -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

2
shared

Submodule shared updated: bccfff0c69...d697709f60