26 lines
406 B
Python
26 lines
406 B
Python
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class CategoryBase(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
|
|
|
|
class CategoryCreate(CategoryBase):
|
|
name: str
|
|
|
|
|
|
class CategoryUpdate(CategoryBase):
|
|
pass
|
|
|
|
|
|
class CategoryInDBBase(CategoryBase):
|
|
id: int
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class Category(CategoryInDBBase):
|
|
pass |