Automated Action 980400187c Create FastAPI backend for communications agency website
- Set up project structure with FastAPI application
- Implement SQLAlchemy models for users, services, projects, team members, contacts
- Create API endpoints for website functionality
- Implement JWT authentication system with user roles
- Add file upload functionality for media
- Configure CORS and health check endpoints
- Add database migrations with Alembic
- Create comprehensive README with setup instructions
2025-06-10 11:00:53 +00:00

35 lines
846 B
Python

from typing import Any
from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from app import crud, models, schemas
from app.api import deps
router = APIRouter()
@router.get("/", response_model=schemas.Settings)
def read_settings(
db: Session = Depends(deps.get_db),
) -> Any:
"""
Retrieve site settings.
"""
settings = crud.settings.get_settings(db)
return settings
@router.put("/", response_model=schemas.Settings)
def update_settings(
*,
db: Session = Depends(deps.get_db),
settings_in: schemas.SettingsUpdate,
current_user: models.User = Depends(deps.get_current_active_superuser),
) -> Any:
"""
Update site settings.
"""
settings = crud.settings.get_settings(db)
settings = crud.settings.update(db, db_obj=settings, obj_in=settings_in)
return settings