Tech debt cleanup: update README, fix comments, sync shared submodule
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m21s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m21s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
50
README.md
50
README.md
@@ -1,10 +1,10 @@
|
|||||||
# Blog App (Coop)
|
# Blog App (Coop)
|
||||||
|
|
||||||
Blog, authentication, and content management service for the Rose Ash cooperative platform. This is the primary "coop" app — it handles Ghost CMS integration, user auth, and admin settings.
|
Blog, authentication, and content management service for the Rose Ash cooperative platform. Handles Ghost CMS integration, user auth, and admin settings.
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
One of four Quart microservices sharing a single PostgreSQL database:
|
One of five Quart microservices sharing a single PostgreSQL database:
|
||||||
|
|
||||||
| App | Port | Domain |
|
| App | Port | Domain |
|
||||||
|-----|------|--------|
|
|-----|------|--------|
|
||||||
@@ -12,6 +12,7 @@ One of four Quart microservices sharing a single PostgreSQL database:
|
|||||||
| market | 8001 | Product browsing, Suma scraping |
|
| market | 8001 | Product browsing, Suma scraping |
|
||||||
| cart | 8002 | Shopping cart, checkout, orders |
|
| cart | 8002 | Shopping cart, checkout, orders |
|
||||||
| events | 8003 | Calendars, bookings, tickets |
|
| events | 8003 | Calendars, bookings, tickets |
|
||||||
|
| federation | 8004 | ActivityPub, fediverse social |
|
||||||
|
|
||||||
## Structure
|
## Structure
|
||||||
|
|
||||||
@@ -19,15 +20,7 @@ One of four Quart microservices sharing a single PostgreSQL database:
|
|||||||
app.py # Application factory (create_base_app + blueprints)
|
app.py # Application factory (create_base_app + blueprints)
|
||||||
path_setup.py # Adds project root + app dir to sys.path
|
path_setup.py # Adds project root + app dir to sys.path
|
||||||
config/app-config.yaml # App URLs, feature flags, SumUp config
|
config/app-config.yaml # App URLs, feature flags, SumUp config
|
||||||
models/ # Blog-domain models
|
models/ # Blog-domain models (+ re-export stubs for shared models)
|
||||||
ghost_content.py # Post, Tag, PostTag
|
|
||||||
ghost_membership_entities.py # GhostNewsletter, UserNewsletter
|
|
||||||
user.py # Re-export of shared User model
|
|
||||||
magic_link.py # Re-export of shared MagicLink model
|
|
||||||
kv.py # Re-export of shared KeyValue model
|
|
||||||
menu_item.py # MenuItem
|
|
||||||
snippet.py # Snippet
|
|
||||||
tag_group.py # TagGroup, TagGroupTag
|
|
||||||
bp/ # Blueprints
|
bp/ # Blueprints
|
||||||
auth/ # Magic link login, account, newsletters
|
auth/ # Magic link login, account, newsletters
|
||||||
blog/ # Post listing, Ghost CMS sync
|
blog/ # Post listing, Ghost CMS sync
|
||||||
@@ -35,31 +28,25 @@ bp/ # Blueprints
|
|||||||
admin/ # Settings admin interface
|
admin/ # Settings admin interface
|
||||||
menu_items/ # Navigation menu management
|
menu_items/ # Navigation menu management
|
||||||
snippets/ # Reusable content snippets
|
snippets/ # Reusable content snippets
|
||||||
coop_api.py # Internal API (/internal/coop/*)
|
|
||||||
templates/ # Jinja2 templates
|
templates/ # Jinja2 templates
|
||||||
entrypoint.sh # Docker entrypoint (runs alembic + starts server)
|
services/ # register_domain_services() — wires blog + calendar + market + cart
|
||||||
Dockerfile
|
shared/ # Submodule -> git.rose-ash.com/coop/shared.git
|
||||||
shared/ # Submodule → git.rose-ash.com/coop/shared.git
|
|
||||||
glue/ # Submodule → git.rose-ash.com/coop/glue.git
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Dependencies
|
## Cross-Domain Communication
|
||||||
|
|
||||||
**Cross-app model imports:**
|
All inter-app communication uses typed service contracts (no HTTP APIs):
|
||||||
- `events.models.calendars.Calendar` — post routes and Ghost sync use calendars attached to pages
|
|
||||||
- `market.models.market_place.MarketPlace` — post admin manages marketplaces on pages
|
|
||||||
- `cart.models.page_config.PageConfig` — post admin manages per-page SumUp config
|
|
||||||
|
|
||||||
**Glue services:**
|
- `services.calendar.*` — calendar/entry queries via CalendarService protocol
|
||||||
- `glue.services.navigation.get_navigation_tree` — context processor builds site nav
|
- `services.market.*` — marketplace queries via MarketService protocol
|
||||||
- `glue.services.relationships.attach_child / detach_child` — post admin attaches/detaches calendars and marketplaces to pages
|
- `services.cart.*` — cart summary via CartService protocol
|
||||||
|
- `services.federation.*` — AP publishing via FederationService protocol
|
||||||
|
- `shared.services.navigation` — site navigation tree
|
||||||
|
|
||||||
**Internal APIs:**
|
## Domain Events
|
||||||
- Calls `GET /internal/cart/summary` — context processor for cart widget
|
|
||||||
- Exposes `/internal/coop/*` — serves blog data to other apps
|
|
||||||
|
|
||||||
**Domain events:**
|
|
||||||
- `auth/routes.py` emits `user.logged_in` via `shared.events.emit_event`
|
- `auth/routes.py` emits `user.logged_in` via `shared.events.emit_event`
|
||||||
|
- Ghost sync emits `post.published` / `post.updated` for federation
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
@@ -71,10 +58,3 @@ export SECRET_KEY=your-secret-key
|
|||||||
alembic -c shared/alembic.ini upgrade head
|
alembic -c shared/alembic.ini upgrade head
|
||||||
hypercorn app:app --bind 0.0.0.0:8000
|
hypercorn app:app --bind 0.0.0.0:8000
|
||||||
```
|
```
|
||||||
|
|
||||||
## Docker
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker build -t blog .
|
|
||||||
docker run -p 8000:8000 --env-file .env blog
|
|
||||||
```
|
|
||||||
|
|||||||
4
app.py
4
app.py
@@ -1,5 +1,5 @@
|
|||||||
from __future__ import annotations
|
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 pathlib import Path
|
||||||
|
|
||||||
from quart import g, request
|
from quart import g, request
|
||||||
@@ -23,7 +23,7 @@ async def coop_context() -> dict:
|
|||||||
"""
|
"""
|
||||||
Coop app context processor.
|
Coop 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)
|
- cart_count/cart_total: via cart service (shared DB)
|
||||||
"""
|
"""
|
||||||
from shared.infrastructure.context import base_context
|
from shared.infrastructure.context import base_context
|
||||||
|
|||||||
@@ -90,8 +90,7 @@ def register(url_prefix="/auth"):
|
|||||||
|
|
||||||
if not g.get("user"):
|
if not g.get("user"):
|
||||||
return redirect(host_url(url_for("auth.login_form")))
|
return redirect(host_url(url_for("auth.login_form")))
|
||||||
# TODO: Create _main_panel.html and _oob_elements.html for optimized HTMX
|
# Full template for both HTMX and normal requests
|
||||||
# For now, render full template for both HTMX and normal requests
|
|
||||||
# Determine which template to use based on request type
|
# Determine which template to use based on request type
|
||||||
if not is_htmx_request():
|
if not is_htmx_request():
|
||||||
# Normal browser request: full page with layout
|
# Normal browser request: full page with layout
|
||||||
|
|||||||
2
shared
2
shared
Submodule shared updated: bccfff0c69...d697709f60
Reference in New Issue
Block a user