All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 50s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
79 lines
3.3 KiB
Markdown
79 lines
3.3 KiB
Markdown
# 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 five 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 |
|
|
| federation | 8004 | ActivityPub, fediverse social |
|
|
|
|
## 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
|
|
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
|
|
services/ # register_domain_services() — wires calendar + market + cart
|
|
shared/ # Submodule -> git.rose-ash.com/coop/shared.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 service calls, not directly.
|
|
|
|
## Cross-Domain Communication
|
|
|
|
- `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.
|
|
|
|
## Running
|
|
|
|
```bash
|
|
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
|
|
```
|