Update app READMEs for monorepo
Remove stale submodule references, port numbers, and Running sections. Add fragment composition details. Create READMEs for federation and account. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,26 +1,13 @@
|
||||
# Cart App
|
||||
|
||||
Shopping cart, checkout, and order management service for the Rose Ash cooperative.
|
||||
|
||||
## 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 |
|
||||
Shopping cart, checkout, and order management service for the Rose Ash cooperative. Integrates with SumUp for payment processing.
|
||||
|
||||
## 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, SumUp config
|
||||
models/ # Cart-domain models (Order, OrderItem, PageConfig)
|
||||
entrypoint.sh # Container entrypoint (Redis flush, start)
|
||||
bp/
|
||||
cart/ # Cart blueprint
|
||||
global_routes.py # Add to cart, checkout, webhooks, return page
|
||||
@@ -37,40 +24,33 @@ bp/
|
||||
clear_cart_for_order.py # Soft-delete cart after checkout
|
||||
order/ # Single order detail view
|
||||
orders/ # Order listing view
|
||||
fragments/ # cart-mini fragment, account-nav-item fragment
|
||||
models/ # Re-export stubs (Order, OrderItem, PageConfig)
|
||||
services/ # register_domain_services() — wires cart + calendar + market
|
||||
shared/ # Submodule -> git.rose-ash.com/coop/shared.git
|
||||
templates/ # Cart-specific templates (override shared/)
|
||||
```
|
||||
|
||||
## Cross-Domain Communication
|
||||
## Cart identity
|
||||
|
||||
Cart items are keyed by `user_id` (logged in) or `session_id` (anonymous). On login, anonymous cart items are adopted to the user's account.
|
||||
|
||||
## Cross-domain communication
|
||||
|
||||
- `services.calendar.*` — claim/confirm entries for orders, adopt on login
|
||||
- `services.market.*` — marketplace queries for page-scoped carts
|
||||
- `services.blog.*` — post lookup for page context
|
||||
- `shared.services.navigation` — site navigation tree
|
||||
|
||||
## Domain Events
|
||||
## Fragments served
|
||||
|
||||
- `checkout.py` emits `order.created` via `shared.events.emit_event`
|
||||
- `check_sumup_status.py` emits `order.paid` via `shared.events.emit_event`
|
||||
- **cart-mini** — cart icon + badge count
|
||||
- **account-nav-item** — orders link for account nav
|
||||
|
||||
## Checkout Flow
|
||||
## Checkout flow
|
||||
|
||||
```
|
||||
1. User clicks "Checkout"
|
||||
2. create_order_from_cart() creates Order + OrderItems
|
||||
3. services.calendar.claim_entries_for_order() marks entries as "ordered"
|
||||
4. emit: order.created event
|
||||
2. `create_order_from_cart()` creates Order + OrderItems
|
||||
3. `services.calendar.claim_entries_for_order()` marks entries as "ordered"
|
||||
4. Emits `Create` / `rose:Order` activity
|
||||
5. SumUp hosted checkout created, user redirected
|
||||
6. SumUp webhook / return page triggers check_sumup_status()
|
||||
7. If PAID: services.calendar.confirm_entries_for_order(), emit: order.paid
|
||||
```
|
||||
|
||||
## 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:8002
|
||||
```
|
||||
6. SumUp webhook / return page triggers `check_sumup_status()`
|
||||
7. If PAID: `services.calendar.confirm_entries_for_order()`, emits `rose:OrderPaid`
|
||||
|
||||
Reference in New Issue
Block a user