This repository has been archived on 2026-02-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
giles 2527c854cb
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 42s
Replace HTTP API and MarketPlace imports with service calls
Calendar entries route now uses services.cart.cart_summary() instead of
internal HTTP API call to cart app. Market CRUD delegates to
services.market.create_marketplace() / soft_delete_marketplace().
Updates shared submodule.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 06:07:20 +00:00

Events App

Calendar and event booking service for the Rose Ash cooperative platform. Manages calendars, time slots, calendar entries (bookings), tickets, and ticket types.

Architecture

One of four Quart microservices sharing a single PostgreSQL database:

App Port Domain
blog (coop) 8000 Auth, blog, admin, menus, snippets
market 8001 Product browsing, Suma scraping
cart 8002 Shopping cart, checkout, orders
events 8003 Calendars, bookings, tickets

Structure

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
bp/                     # Blueprints
  calendars/            #   Calendar listing
  calendar/             #   Single calendar view and admin
  calendar_entries/     #   Calendar entries listing
  calendar_entry/       #   Single entry view and admin
  day/                  #   Day view and admin
  slots/                #   Slot listing
  slot/                 #   Single slot management
  ticket_types/         #   Ticket type listing
  ticket_type/          #   Single ticket type management
  tickets/              #   Ticket listing
  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

Models

All events-domain models live in models/calendars.py:

Model Description
Calendar Container for entries, scoped to a page via container_type + container_id
CalendarEntry A bookable event/time slot. Has state (pending/ordered/provisional), cost, ownership (user_id/session_id), and order_id (plain integer, no FK)
CalendarSlot Recurring time bands (day-of-week + time range) within a calendar
TicketType Named ticket categories with price and count
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.

Dependencies

Cross-app model imports:

  • blog.models.ghost_content.Postapp.py context processor, calendar/market services for page hydration
  • market.models.market_place.MarketPlaceapp.py context processor, marketplace views
  • cart.models.page_config.PageConfigbp/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

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.

Running

export DATABASE_URL_ASYNC=postgresql+asyncpg://user:pass@localhost/coop
export REDIS_URL=redis://localhost:6379/0
export SECRET_KEY=your-secret-key

hypercorn app:app --bind 0.0.0.0:8003

Docker

docker build -t events .
docker run -p 8003:8000 --env-file .env events
Description
No description provided
Readme 578 KiB
Languages
HTML 51%
Python 48.4%
Shell 0.3%
Dockerfile 0.3%