
- 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
23 lines
747 B
Python
23 lines
747 B
Python
from sqlalchemy.orm import Session
|
|
|
|
from app.crud.base import CRUDBase
|
|
from app.models.settings import Settings
|
|
from app.schemas.settings import SettingsCreate, SettingsUpdate
|
|
|
|
|
|
class CRUDSettings(CRUDBase[Settings, SettingsCreate, SettingsUpdate]):
|
|
def get_settings(self, db: Session) -> Settings:
|
|
"""Get the site settings. Creates default settings if none exist."""
|
|
settings = db.query(Settings).first()
|
|
if not settings:
|
|
settings = self.create(
|
|
db,
|
|
obj_in=SettingsCreate(
|
|
site_name="Communications Agency",
|
|
contact_email="info@example.com",
|
|
),
|
|
)
|
|
return settings
|
|
|
|
|
|
settings = CRUDSettings(Settings) |