style: apply black and isort formatting across entire codebase
- Standardize quote style (single to double quotes) - Reorder and group imports alphabetically - Fix line breaks and indentation for consistency - Apply PEP 8 formatting standards Also updated Makefile to exclude both venv and .venv from code quality checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ No authentication required.
|
||||
|
||||
import logging
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request
|
||||
from pydantic import BaseModel
|
||||
from sqlalchemy.orm import Session
|
||||
@@ -23,8 +24,10 @@ logger = logging.getLogger(__name__)
|
||||
# RESPONSE SCHEMAS
|
||||
# ============================================================================
|
||||
|
||||
|
||||
class PublicContentPageResponse(BaseModel):
|
||||
"""Public content page response (no internal IDs)."""
|
||||
|
||||
slug: str
|
||||
title: str
|
||||
content: str
|
||||
@@ -36,6 +39,7 @@ class PublicContentPageResponse(BaseModel):
|
||||
|
||||
class ContentPageListItem(BaseModel):
|
||||
"""Content page list item for navigation."""
|
||||
|
||||
slug: str
|
||||
title: str
|
||||
show_in_footer: bool
|
||||
@@ -47,25 +51,21 @@ class ContentPageListItem(BaseModel):
|
||||
# PUBLIC ENDPOINTS
|
||||
# ============================================================================
|
||||
|
||||
|
||||
@router.get("/navigation", response_model=List[ContentPageListItem])
|
||||
def get_navigation_pages(
|
||||
request: Request,
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
def get_navigation_pages(request: Request, db: Session = Depends(get_db)):
|
||||
"""
|
||||
Get list of content pages for navigation (footer/header).
|
||||
|
||||
Uses vendor from request.state (set by middleware).
|
||||
Returns vendor overrides + platform defaults.
|
||||
"""
|
||||
vendor = getattr(request.state, 'vendor', None)
|
||||
vendor = getattr(request.state, "vendor", None)
|
||||
vendor_id = vendor.id if vendor else None
|
||||
|
||||
# Get all published pages for this vendor
|
||||
pages = content_page_service.list_pages_for_vendor(
|
||||
db,
|
||||
vendor_id=vendor_id,
|
||||
include_unpublished=False
|
||||
db, vendor_id=vendor_id, include_unpublished=False
|
||||
)
|
||||
|
||||
return [
|
||||
@@ -81,25 +81,21 @@ def get_navigation_pages(
|
||||
|
||||
|
||||
@router.get("/{slug}", response_model=PublicContentPageResponse)
|
||||
def get_content_page(
|
||||
slug: str,
|
||||
request: Request,
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
def get_content_page(slug: str, request: Request, db: Session = Depends(get_db)):
|
||||
"""
|
||||
Get a specific content page by slug.
|
||||
|
||||
Uses vendor from request.state (set by middleware).
|
||||
Returns vendor override if exists, otherwise platform default.
|
||||
"""
|
||||
vendor = getattr(request.state, 'vendor', None)
|
||||
vendor = getattr(request.state, "vendor", None)
|
||||
vendor_id = vendor.id if vendor else None
|
||||
|
||||
page = content_page_service.get_page_for_vendor(
|
||||
db,
|
||||
slug=slug,
|
||||
vendor_id=vendor_id,
|
||||
include_unpublished=False # Only show published pages
|
||||
include_unpublished=False, # Only show published pages
|
||||
)
|
||||
|
||||
if not page:
|
||||
|
||||
Reference in New Issue
Block a user