2020-01-19 22:40:50 +01:00
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
|
|
|
# Shared properties
|
|
|
|
class ItemBase(BaseModel):
|
2024-02-25 19:39:33 +01:00
|
|
|
title: str | None = None
|
|
|
|
description: str | None = None
|
2020-01-19 22:40:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Properties to receive on item creation
|
|
|
|
class ItemCreate(ItemBase):
|
|
|
|
title: str
|
|
|
|
|
|
|
|
|
|
|
|
# Properties to receive on item update
|
|
|
|
class ItemUpdate(ItemBase):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
# Properties shared by models stored in DB
|
|
|
|
class ItemInDBBase(ItemBase):
|
|
|
|
id: int
|
|
|
|
title: str
|
|
|
|
owner_id: int
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
orm_mode = True
|
|
|
|
|
|
|
|
|
|
|
|
# Properties to return to client
|
|
|
|
class Item(ItemInDBBase):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
# Properties properties stored in DB
|
|
|
|
class ItemInDB(ItemInDBBase):
|
|
|
|
pass
|