
- Add proper model relationships for better querying - Implement character model and endpoints for managing anime characters - Add advanced filtering options (year, score range, source, studio, etc.) - Add statistics endpoint for analyzing anime collection - Include pagination metadata for easier navigation - Create Alembic migration for the new character model - Update README with new features and documentation
15 lines
533 B
Python
15 lines
533 B
Python
from typing import List
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.crud.base import CRUDBase
|
|
from app.models.character import Character
|
|
from app.schemas.character import CharacterCreate, CharacterUpdate
|
|
|
|
|
|
class CRUDCharacter(CRUDBase[Character, CharacterCreate, CharacterUpdate]):
|
|
def get_by_anime(self, db: Session, *, anime_id: int) -> List[Character]:
|
|
"""Get all characters for a specific anime"""
|
|
return db.query(Character).filter(Character.anime_id == anime_id).all()
|
|
|
|
|
|
character = CRUDCharacter(Character) |