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

@@ -73,13 +73,13 @@
<div class="hidden md:flex items-center space-x-8">
{# Main Navigation #}
<a href="/pricing" class="text-gray-700 dark:text-gray-300 hover:text-indigo-600 dark:hover:text-indigo-400 font-medium transition-colors">
{{ _("platform.nav.pricing") }}
{{ _("cms.platform.nav.pricing") }}
</a>
<a href="/find-shop" class="text-gray-700 dark:text-gray-300 hover:text-indigo-600 dark:hover:text-indigo-400 font-medium transition-colors">
{{ _("platform.nav.find_shop") }}
{{ _("cms.platform.nav.find_shop") }}
</a>
<a href="/signup" class="px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white font-medium rounded-lg transition-colors">
{{ _("platform.nav.start_trial") }}
{{ _("cms.platform.nav.start_trial") }}
</a>
{# Dynamic header navigation from CMS #}
@@ -131,7 +131,7 @@
<button
@click="toggleDarkMode()"
class="p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors"
aria-label="{{ _('platform.nav.toggle_dark_mode') }}"
aria-label="{{ _('cms.platform.nav.toggle_dark_mode') }}"
>
<svg x-show="!dark" class="w-5 h-5 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"></path>
@@ -147,7 +147,7 @@
<button
@click="mobileMenuOpen = !mobileMenuOpen"
class="p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700"
aria-label="{{ _('platform.nav.toggle_menu') }}"
aria-label="{{ _('cms.platform.nav.toggle_menu') }}"
>
<svg x-show="!mobileMenuOpen" class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
@@ -194,13 +194,13 @@
</span>
</div>
<p class="text-gray-600 dark:text-gray-400 text-sm">
{{ _("platform.footer.tagline") }}
{{ _("cms.platform.footer.tagline") }}
</p>
</div>
{# Quick Links #}
<div>
<h4 class="font-semibold text-gray-900 dark:text-white mb-4">{{ _("platform.footer.quick_links") }}</h4>
<h4 class="font-semibold text-gray-900 dark:text-white mb-4">{{ _("cms.platform.footer.quick_links") }}</h4>
<ul class="space-y-2">
{% if footer_pages %}
{% for page in footer_pages %}
@@ -217,16 +217,16 @@
{# Platform Links #}
<div>
<h4 class="font-semibold text-gray-900 dark:text-white mb-4">{{ _("platform.footer.platform") }}</h4>
<h4 class="font-semibold text-gray-900 dark:text-white mb-4">{{ _("cms.platform.footer.platform") }}</h4>
<ul class="space-y-2">
<li>
<a href="/admin/login" class="text-gray-600 dark:text-gray-400 hover:text-primary transition-colors">
{{ _("platform.nav.admin_login") }}
{{ _("cms.platform.nav.admin_login") }}
</a>
</li>
<li>
<a href="/vendor/wizamart/login" class="text-gray-600 dark:text-gray-400 hover:text-primary transition-colors">
{{ _("platform.nav.vendor_login") }}
{{ _("cms.platform.nav.vendor_login") }}
</a>
</li>
</ul>
@@ -234,7 +234,7 @@
{# Contact Info #}
<div>
<h4 class="font-semibold text-gray-900 dark:text-white mb-4">{{ _("platform.footer.contact") }}</h4>
<h4 class="font-semibold text-gray-900 dark:text-white mb-4">{{ _("cms.platform.footer.contact") }}</h4>
<ul class="space-y-2 text-gray-600 dark:text-gray-400 text-sm">
<li>support@marketplace.com</li>
<li>+1 (555) 123-4567</li>
@@ -248,7 +248,7 @@
<div class="mt-12 pt-8 border-t border-gray-200 dark:border-gray-700">
<div class="flex flex-col md:flex-row justify-between items-center">
<p class="text-gray-600 dark:text-gray-400 text-sm">
{{ _("platform.footer.copyright", year=2025) }}
{{ _("cms.platform.footer.copyright", year=2025) }}
</p>
<div class="flex space-x-6 mt-4 md:mt-0">
{% if legal_pages %}
@@ -260,10 +260,10 @@
{% else %}
{# Fallback to hardcoded links if no CMS pages #}
<a href="/privacy" class="text-gray-600 dark:text-gray-400 hover:text-primary text-sm transition-colors">
{{ _("platform.footer.privacy") }}
{{ _("cms.platform.footer.privacy") }}
</a>
<a href="/terms" class="text-gray-600 dark:text-gray-400 hover:text-primary text-sm transition-colors">
{{ _("platform.footer.terms") }}
{{ _("cms.platform.footer.terms") }}
</a>
{% endif %}
</div>