Automated Action a9210ca8ed Create manga inventory API with FastAPI and SQLite
- Implemented CRUD operations for manga, authors, publishers, and genres
- Added search and filtering functionality
- Set up SQLAlchemy ORM with SQLite database
- Configured Alembic for database migrations
- Implemented logging with Loguru
- Added comprehensive API documentation
- Set up error handling and validation
- Added ruff for linting and formatting
2025-05-30 12:29:35 +00:00

40 lines
876 B
Python

from datetime import datetime
from pydantic import BaseModel, Field
# Shared properties
class GenreBase(BaseModel):
name: str = Field(..., min_length=1, max_length=50, description="Name of the genre")
description: str | None = Field(None, description="Description of the genre")
# Properties to receive on genre creation
class GenreCreate(GenreBase):
pass
# Properties to receive on genre update
class GenreUpdate(GenreBase):
name: str | None = Field(None, min_length=1, max_length=50, description="Name of the genre")
# Properties shared by models stored in DB
class GenreInDBBase(GenreBase):
id: int
created_at: datetime
updated_at: datetime
class Config:
orm_mode = True
# Properties to return to client
class Genre(GenreInDBBase):
pass
# Properties properties stored in DB
class GenreInDB(GenreInDBBase):
pass