27 lines
937 B
Python
27 lines
937 B
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
|
|
# Base schema for BountyCharacter
|
|
class BountyCharacterBase(BaseModel):
|
|
name: str = Field(..., description="Name of the bounty character")
|
|
bounty: int = Field(..., description="Bounty amount on the character's head")
|
|
|
|
# Schema for creating a new BountyCharacter
|
|
class BountyCharacterCreate(BountyCharacterBase):
|
|
pass
|
|
|
|
# Schema for updating an existing BountyCharacter
|
|
class BountyCharacterUpdate(BountyCharacterBase):
|
|
name: Optional[str] = Field(None, description="Name of the bounty character")
|
|
bounty: Optional[int] = Field(None, description="Bounty amount on the character's head")
|
|
|
|
# Schema for representing a BountyCharacter in responses
|
|
class BountyCharacterSchema(BountyCharacterBase):
|
|
id: UUID
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
orm_mode = True |