All checks were successful
- Fix platform-grouped merchant sidebar menu with core items at root level - Add merchant store management (detail page, create store, team page) - Fix store settings 500 error by removing dead stripe/API tab - Move onboarding translations to module-owned locale files - Fix onboarding banner i18n with server-side rendering + context inheritance - Refactor login language selectors to use languageSelector() function (LANG-002) - Move HTTPException handling to global exception handler in merchant routes (API-003) - Add language selector to all login pages and portal headers - Fix customer module: drop order stats from customer model, add to orders module - Fix admin menu config visibility for super admin platform context - Fix storefront auth and layout issues - Add missing i18n translations for onboarding steps (en/fr/de/lb) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
184 lines
5.7 KiB
Python
184 lines
5.7 KiB
Python
# app/modules/core/definition.py
|
|
"""
|
|
Core Platform module definition.
|
|
|
|
Dashboard, settings, and profile management.
|
|
Required for basic operation - cannot be disabled.
|
|
"""
|
|
|
|
from app.modules.base import (
|
|
MenuItemDefinition,
|
|
MenuSectionDefinition,
|
|
ModuleDefinition,
|
|
PermissionDefinition,
|
|
)
|
|
from app.modules.enums import FrontendType
|
|
|
|
core_module = ModuleDefinition(
|
|
code="core",
|
|
name="Core Platform",
|
|
description="Dashboard, settings, and profile management. Required for basic operation.",
|
|
version="1.0.0",
|
|
is_core=True,
|
|
is_self_contained=True,
|
|
# Module-driven permissions
|
|
permissions=[
|
|
PermissionDefinition(
|
|
id="dashboard.view",
|
|
label_key="core.permissions.dashboard_view",
|
|
description_key="core.permissions.dashboard_view_desc",
|
|
category="dashboard",
|
|
),
|
|
PermissionDefinition(
|
|
id="settings.view",
|
|
label_key="core.permissions.settings_view",
|
|
description_key="core.permissions.settings_view_desc",
|
|
category="settings",
|
|
),
|
|
PermissionDefinition(
|
|
id="settings.edit",
|
|
label_key="core.permissions.settings_edit",
|
|
description_key="core.permissions.settings_edit_desc",
|
|
category="settings",
|
|
),
|
|
PermissionDefinition(
|
|
id="settings.theme",
|
|
label_key="core.permissions.settings_theme",
|
|
description_key="core.permissions.settings_theme_desc",
|
|
category="settings",
|
|
),
|
|
PermissionDefinition(
|
|
id="settings.domains",
|
|
label_key="core.permissions.settings_domains",
|
|
description_key="core.permissions.settings_domains_desc",
|
|
category="settings",
|
|
is_owner_only=True, # Only owners can manage domains
|
|
),
|
|
],
|
|
features=[
|
|
"dashboard",
|
|
"settings",
|
|
"profile",
|
|
],
|
|
# Legacy menu_items (IDs only)
|
|
menu_items={
|
|
FrontendType.ADMIN: [
|
|
"dashboard",
|
|
"settings",
|
|
"email-templates",
|
|
],
|
|
FrontendType.STORE: [
|
|
"dashboard",
|
|
"profile",
|
|
"settings",
|
|
"email-templates",
|
|
],
|
|
FrontendType.MERCHANT: [
|
|
"dashboard",
|
|
],
|
|
},
|
|
# New module-driven menu definitions
|
|
menus={
|
|
FrontendType.ADMIN: [
|
|
MenuSectionDefinition(
|
|
id="main",
|
|
label_key=None, # No header for main section
|
|
icon=None,
|
|
order=0,
|
|
is_collapsible=False,
|
|
items=[
|
|
MenuItemDefinition(
|
|
id="dashboard",
|
|
label_key="core.menu.dashboard",
|
|
icon="home",
|
|
route="/admin/dashboard",
|
|
order=10,
|
|
is_mandatory=True,
|
|
),
|
|
],
|
|
),
|
|
MenuSectionDefinition(
|
|
id="settings",
|
|
label_key="core.menu.platform_settings",
|
|
icon="cog",
|
|
order=900,
|
|
items=[
|
|
MenuItemDefinition(
|
|
id="settings",
|
|
label_key="core.menu.general",
|
|
icon="cog",
|
|
route="/admin/settings",
|
|
order=10,
|
|
is_mandatory=True,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
FrontendType.MERCHANT: [
|
|
MenuSectionDefinition(
|
|
id="main",
|
|
label_key=None,
|
|
icon=None,
|
|
order=0,
|
|
is_collapsible=False,
|
|
items=[
|
|
MenuItemDefinition(
|
|
id="dashboard",
|
|
label_key="core.menu.dashboard",
|
|
icon="home",
|
|
route="/merchants/dashboard",
|
|
order=10,
|
|
is_mandatory=True,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
FrontendType.STORE: [
|
|
MenuSectionDefinition(
|
|
id="main",
|
|
label_key=None,
|
|
icon=None,
|
|
order=0,
|
|
is_collapsible=False,
|
|
items=[
|
|
MenuItemDefinition(
|
|
id="dashboard",
|
|
label_key="core.menu.dashboard",
|
|
icon="home",
|
|
route="/store/{store_code}/dashboard",
|
|
order=10,
|
|
is_mandatory=True,
|
|
requires_permission="dashboard.view",
|
|
),
|
|
],
|
|
),
|
|
MenuSectionDefinition(
|
|
id="account",
|
|
label_key="core.menu.account_settings",
|
|
icon="user",
|
|
order=900,
|
|
items=[
|
|
MenuItemDefinition(
|
|
id="profile",
|
|
label_key="core.menu.profile",
|
|
icon="user",
|
|
route="/store/{store_code}/profile",
|
|
order=10,
|
|
),
|
|
MenuItemDefinition(
|
|
id="settings",
|
|
label_key="core.menu.settings",
|
|
icon="cog",
|
|
route="/store/{store_code}/settings",
|
|
order=20,
|
|
is_mandatory=True,
|
|
requires_permission="settings.view",
|
|
),
|
|
],
|
|
),
|
|
],
|
|
},
|
|
)
|
|
|
|
__all__ = ["core_module"]
|