Templates Migration: - Migrate admin templates to modules (tenancy, billing, monitoring, marketplace, etc.) - Migrate vendor templates to modules (tenancy, billing, orders, messaging, etc.) - Migrate storefront templates to modules (catalog, customers, orders, cart, checkout, cms) - Migrate public templates to modules (billing, marketplace, cms) - Keep shared templates in app/templates/ (base.html, errors/, partials/, macros/) - Migrate letzshop partials to marketplace module Static Files Migration: - Migrate admin JS to modules: tenancy (23 files), core (5 files), monitoring (1 file) - Migrate vendor JS to modules: tenancy (4 files), core (2 files) - Migrate shared JS: vendor-selector.js to core, media-picker.js to cms - Migrate storefront JS: storefront-layout.js to core - Keep framework JS in static/ (api-client, utils, money, icons, log-config, lib/) - Update all template references to use module_static paths Naming Consistency: - Rename static/platform/ to static/public/ - Rename app/templates/platform/ to app/templates/public/ - Update all extends and static references Documentation: - Update module-system.md with shared templates documentation - Update frontend-structure.md with new module JS organization Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
# app/modules/tenancy/routes/api/vendor_profile.py
|
|
"""
|
|
Vendor profile management endpoints.
|
|
|
|
Vendor Context: Uses token_vendor_id from JWT token (authenticated vendor API pattern).
|
|
The get_current_vendor_api dependency guarantees token_vendor_id is present.
|
|
"""
|
|
|
|
import logging
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.api.deps import get_current_vendor_api
|
|
from app.core.database import get_db
|
|
from app.modules.tenancy.services.vendor_service import vendor_service
|
|
from models.schema.auth import UserContext
|
|
from models.schema.vendor import VendorResponse, VendorUpdate
|
|
|
|
vendor_profile_router = APIRouter(prefix="/profile")
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@vendor_profile_router.get("", response_model=VendorResponse)
|
|
def get_vendor_profile(
|
|
current_user: UserContext = Depends(get_current_vendor_api),
|
|
db: Session = Depends(get_db),
|
|
):
|
|
"""Get current vendor profile information."""
|
|
vendor = vendor_service.get_vendor_by_id(db, current_user.token_vendor_id)
|
|
return vendor
|
|
|
|
|
|
@vendor_profile_router.put("", response_model=VendorResponse)
|
|
def update_vendor_profile(
|
|
vendor_update: VendorUpdate,
|
|
current_user: UserContext = Depends(get_current_vendor_api),
|
|
db: Session = Depends(get_db),
|
|
):
|
|
"""Update vendor profile information."""
|
|
# Service handles permission checking and raises InsufficientPermissionsException if needed
|
|
return vendor_service.update_vendor(
|
|
db, current_user.token_vendor_id, vendor_update, current_user
|
|
)
|