from sqlalchemy.orm import Session from app.crud.base import CRUDBase from app.models.manga import Author from app.schemas.author import AuthorCreate, AuthorUpdate class CRUDAuthor(CRUDBase[Author, AuthorCreate, AuthorUpdate]): def get_by_name(self, db: Session, *, name: str) -> Author | None: """ Get an author by name. """ return db.query(Author).filter(Author.name == name).first() def get_multi_with_manga(self, db: Session, *, skip: int = 0, limit: int = 100) -> list[Author]: """ Get multiple authors with their manga lists. """ return db.query(Author).offset(skip).limit(limit).all() author = CRUDAuthor(Author)