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

33 lines
1000 B
Python

from typing import List, Optional
from sqlalchemy.orm import Session
from app.crud.base import CRUDBase
from app.models.project import Project
from app.schemas.project import ProjectCreate, ProjectUpdate
class CRUDProject(CRUDBase[Project, ProjectCreate, ProjectUpdate]):
def get_by_slug(self, db: Session, *, slug: str) -> Optional[Project]:
return db.query(Project).filter(Project.slug == slug).first()
def get_active(self, db: Session, *, skip: int = 0, limit: int = 100) -> List[Project]:
return (
db.query(Project)
.filter(Project.is_active)
.offset(skip)
.limit(limit)
.all()
)
def get_featured(self, db: Session, *, skip: int = 0, limit: int = 100) -> List[Project]:
return (
db.query(Project)
.filter(Project.is_active, Project.is_featured)
.offset(skip)
.limit(limit)
.all()
)
project = CRUDProject(Project)