Automated Action 4d6c2e1778 Implement Anime Information API with FastAPI and SQLite
- Create project structure and dependencies
- Set up SQLAlchemy models for anime, genres, and their relationships
- Implement CRUD operations for all models
- Set up FastAPI endpoints for managing anime and genres
- Add health check endpoint
- Configure Alembic for database migrations
- Add data seeding capability
- Update README with project information
2025-05-17 21:37:16 +00:00

17 lines
568 B
Python

from typing import List, Optional
from sqlalchemy.orm import Session
from app.crud.base import CRUDBase
from app.models.genre import Genre
from app.schemas.genre import GenreCreate, GenreUpdate
class CRUDGenre(CRUDBase[Genre, GenreCreate, GenreUpdate]):
def get_by_name(self, db: Session, *, name: str) -> Optional[Genre]:
return db.query(Genre).filter(Genre.name == name).first()
def get_multiple_by_ids(self, db: Session, *, ids: List[int]) -> List[Genre]:
return db.query(Genre).filter(Genre.id.in_(ids)).all()
genre = CRUDGenre(Genre)