Add Book schema
This commit is contained in:
parent
f4565e203e
commit
fcb499a942
@ -2,7 +2,6 @@ from pydantic import BaseModel, Field
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
|
|
||||||
class BookBase(BaseModel):
|
class BookBase(BaseModel):
|
||||||
title: str = Field(..., min_length=1, max_length=200, description="Book title")
|
title: str = Field(..., min_length=1, max_length=200, description="Book title")
|
||||||
description: Optional[str] = Field(None, description="Book description")
|
description: Optional[str] = Field(None, description="Book description")
|
||||||
@ -10,7 +9,6 @@ class BookBase(BaseModel):
|
|||||||
publication_year: int = Field(..., ge=1000, le=9999, description="Year of publication")
|
publication_year: int = Field(..., ge=1000, le=9999, description="Year of publication")
|
||||||
author_id: str = Field(..., description="ID of the book's author")
|
author_id: str = Field(..., description="ID of the book's author")
|
||||||
|
|
||||||
|
|
||||||
class BookCreate(BookBase):
|
class BookCreate(BookBase):
|
||||||
class Config:
|
class Config:
|
||||||
schema_extra = {
|
schema_extra = {
|
||||||
@ -23,7 +21,6 @@ class BookCreate(BookBase):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Book(BookBase):
|
class Book(BookBase):
|
||||||
id: UUID
|
id: UUID
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user