Decouple cross-app models: move canonical definitions to shared/models/

- Move 6 model files to shared/models/ (ghost_content, order, page_config,
  market, market_place, calendars) so apps import from shared, not each other
- Fix auth templates: replace url_for('auth.*') with coop_url() for
  cross-app compatibility
- Fix TYPE_CHECKING import in sumup.py to use shared.models.order
- Delete dead infrastructure/cart_loader.py (inverted dependency)
- Update models/__init__.py to export all new models

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-18 20:46:36 +00:00
parent da10fc4cf9
commit 0c0f3c8416
14 changed files with 1180 additions and 17 deletions

View File

@@ -9,7 +9,7 @@ from quart import current_app
from shared.config import config
if TYPE_CHECKING:
from cart.models.order import Order
from shared.models.order import Order
SUMUP_BASE_URL = "https://api.sumup.com/v0.1"

View File

@@ -18,7 +18,7 @@
{% endif %}
{% endif %}
</div>
<form action="{{ url_for('auth.logout')|host }}" method="post">
<form action="{{ coop_url('/auth/logout/') }}" method="post">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button
type="submit"

View File

@@ -1,6 +1,6 @@
<div id="nl-{{ un.newsletter_id }}" class="flex items-center">
<button
hx-post="{{ url_for('auth.toggle_newsletter', newsletter_id=un.newsletter_id) }}"
hx-post="{{ coop_url('/auth/newsletter/' ~ un.newsletter_id ~ '/toggle/') }}"
hx-headers='{"X-CSRFToken": "{{ csrf_token() }}"}'
hx-target="#nl-{{ un.newsletter_id }}"
hx-swap="outerHTML"

View File

@@ -22,7 +22,7 @@
{# No subscription row yet — show an off toggle that will create one #}
<div id="nl-{{ item.newsletter.id }}" class="flex items-center">
<button
hx-post="{{ url_for('auth.toggle_newsletter', newsletter_id=item.newsletter.id) }}"
hx-post="{{ coop_url('/auth/newsletter/' ~ item.newsletter.id ~ '/toggle/') }}"
hx-headers='{"X-CSRFToken": "{{ csrf_token() }}"}'
hx-target="#nl-{{ item.newsletter.id }}"
hx-swap="outerHTML"

View File

@@ -22,7 +22,7 @@
<p class="mt-6 text-sm">
<a
href="{{ url_for('auth.login_form')|host }}"
href="{{ coop_url('/auth/login/') }}"
class="text-stone-600 dark:text-stone-300 hover:underline"
>
← Back

View File

@@ -14,7 +14,7 @@
{% endif %}
<form
method="post" action="{{ url_for('auth.start_login')|host }}"
method="post" action="{{ coop_url('/auth/start/') }}"
class="mt-6 space-y-5"
>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">