refactor: complete module-driven architecture migration

This commit completes the migration to a fully module-driven architecture:

## Models Migration
- Moved all domain models from models/database/ to their respective modules:
  - tenancy: User, Admin, Vendor, Company, Platform, VendorDomain, etc.
  - cms: MediaFile, VendorTheme
  - messaging: Email, VendorEmailSettings, VendorEmailTemplate
  - core: AdminMenuConfig
- models/database/ now only contains Base and TimestampMixin (infrastructure)

## Schemas Migration
- Moved all domain schemas from models/schema/ to their respective modules:
  - tenancy: company, vendor, admin, team, vendor_domain
  - cms: media, image, vendor_theme
  - messaging: email
- models/schema/ now only contains base.py and auth.py (infrastructure)

## Routes Migration
- Moved admin routes from app/api/v1/admin/ to modules:
  - menu_config.py -> core module
  - modules.py -> tenancy module
  - module_config.py -> tenancy module
- app/api/v1/admin/ now only aggregates auto-discovered module routes

## Menu System
- Implemented module-driven menu system with MenuDiscoveryService
- Extended FrontendType enum: PLATFORM, ADMIN, VENDOR, STOREFRONT
- Added MenuItemDefinition and MenuSectionDefinition dataclasses
- Each module now defines its own menu items in definition.py
- MenuService integrates with MenuDiscoveryService for template rendering

## Documentation
- Updated docs/architecture/models-structure.md
- Updated docs/architecture/menu-management.md
- Updated architecture validation rules for new exceptions

## Architecture Validation
- Updated MOD-019 rule to allow base.py in models/schema/
- Created core module exceptions.py and schemas/ directory
- All validation errors resolved (only warnings remain)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-01 21:02:56 +01:00
parent 09d7d282c6
commit d7a0ff8818
307 changed files with 5536 additions and 3826 deletions

View File

@@ -2,7 +2,7 @@
{# Letzshop Vendor Finder Page #}
{% extends "public/base.html" %}
{% block title %}{{ _("platform.find_shop.title") }} - Wizamart{% endblock %}
{% block title %}{{ _("cms.platform.find_shop.title") }} - Wizamart{% endblock %}
{% block content %}
<div x-data="vendorFinderData()" class="py-16 lg:py-24">
@@ -10,10 +10,10 @@
{# Header #}
<div class="text-center mb-12">
<h1 class="text-4xl md:text-5xl font-bold text-gray-900 dark:text-white mb-4">
{{ _("platform.find_shop.title") }}
{{ _("cms.platform.find_shop.title") }}
</h1>
<p class="text-xl text-gray-600 dark:text-gray-400">
{{ _("platform.find_shop.subtitle") }}
{{ _("cms.platform.find_shop.subtitle") }}
</p>
</div>
@@ -24,7 +24,7 @@
type="text"
x-model="searchQuery"
@keyup.enter="lookupVendor()"
placeholder="{{ _('platform.find_shop.search_placeholder') }}"
placeholder="{{ _('cms.platform.find_shop.search_placeholder') }}"
class="flex-1 px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-white placeholder-gray-400 focus:ring-2 focus:ring-indigo-500 focus:border-transparent"
/>
<button
@@ -38,14 +38,14 @@
</svg>
</template>
<template x-if="!loading">
<span>{{ _("platform.find_shop.search_button") }}</span>
<span>{{ _("cms.platform.find_shop.search_button") }}</span>
</template>
</button>
</div>
{# Examples #}
<div class="mt-4 text-sm text-gray-500 dark:text-gray-400">
<strong>{{ _("platform.find_shop.examples") }}</strong>
<strong>{{ _("cms.platform.find_shop.examples") }}</strong>
<ul class="list-disc list-inside mt-1">
<li>https://letzshop.lu/vendors/my-shop</li>
<li>letzshop.lu/vendors/my-shop</li>
@@ -61,7 +61,7 @@
<div class="p-8">
<div class="flex items-start justify-between">
<div>
<p class="text-sm text-green-600 font-medium mb-1">{{ _("platform.find_shop.found") }}</p>
<p class="text-sm text-green-600 font-medium mb-1">{{ _("cms.platform.find_shop.found") }}</p>
<h2 class="text-2xl font-bold text-gray-900 dark:text-white" x-text="result.vendor.name"></h2>
<a :href="result.vendor.letzshop_url" target="_blank"
class="text-indigo-600 dark:text-indigo-400 hover:underline mt-1 inline-block"
@@ -82,15 +82,15 @@
<template x-if="!result.vendor.is_claimed">
<a :href="'/signup?letzshop=' + result.vendor.slug"
class="px-8 py-3 bg-green-600 hover:bg-green-700 text-white font-semibold rounded-xl transition-colors">
{{ _("platform.find_shop.claim_button") }}
{{ _("cms.platform.find_shop.claim_button") }}
</a>
</template>
<template x-if="result.vendor.is_claimed">
<div class="px-6 py-3 bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400 rounded-xl">
<span class="inline-flex items-center">
<span class="text-yellow-500 mr-2">{{ _("platform.find_shop.claimed_badge") }}</span>
<span class="text-yellow-500 mr-2">{{ _("cms.platform.find_shop.claimed_badge") }}</span>
</span>
{{ _("platform.find_shop.already_claimed") }}
{{ _("cms.platform.find_shop.already_claimed") }}
</div>
</template>
</div>
@@ -102,12 +102,12 @@
<svg class="w-16 h-16 text-gray-400 mx-auto mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<h3 class="text-xl font-semibold text-gray-900 dark:text-white mb-2">{{ _("platform.find_shop.not_found") }}</h3>
<p class="text-gray-600 dark:text-gray-400" x-text="result.error || '{{ _("platform.find_shop.not_found") }}'"></p>
<h3 class="text-xl font-semibold text-gray-900 dark:text-white mb-2">{{ _("cms.platform.find_shop.not_found") }}</h3>
<p class="text-gray-600 dark:text-gray-400" x-text="result.error || '{{ _("cms.platform.find_shop.not_found") }}'"></p>
<div class="mt-6">
<a href="/signup" class="text-indigo-600 dark:text-indigo-400 hover:underline">
{{ _("platform.find_shop.or_signup") }} &rarr;
{{ _("cms.platform.find_shop.or_signup") }} &rarr;
</a>
</div>
</div>
@@ -117,18 +117,18 @@
{# Help Section #}
<div class="mt-12 text-center">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">{{ _("platform.find_shop.need_help") }}</h3>
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">{{ _("cms.platform.find_shop.need_help") }}</h3>
<p class="text-gray-600 dark:text-gray-400 mb-4">
{{ _("platform.find_shop.no_account_yet") }}
{{ _("cms.platform.find_shop.no_account_yet") }}
</p>
<div class="flex flex-col sm:flex-row gap-4 justify-center">
<a href="https://letzshop.lu" target="_blank"
class="px-6 py-3 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 font-medium rounded-xl hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors">
{{ _("platform.find_shop.create_letzshop") }}
{{ _("cms.platform.find_shop.create_letzshop") }}
</a>
<a href="/signup"
class="px-6 py-3 bg-indigo-600 hover:bg-indigo-700 text-white font-medium rounded-xl transition-colors">
{{ _("platform.find_shop.signup_without") }}
{{ _("cms.platform.find_shop.signup_without") }}
</a>
</div>
</div>