porridger/back/schemas.py

58 lines
1.2 KiB
Python

from pydantic import BaseModel
from typing import Annotated, Union
from datetime import date
class Book(BaseModel):
id: int
class DelAnnouncement(BaseModel):
id: int
class Announcement(BaseModel):
id: int
user_id: int
name: str
category: str
best_by: date
address: str
longtitude: float
latitude: float
description: str
src: Union[str, None] = None #изображение продукта в объявлении
metro: str #ближайщее метро от адреса нахождения продукта
trashId: Union[int, None] = None
booked_by: int #статус бронирования (либо -1, либо айди бронирующего)
class Token(BaseModel):
access_token: str
# token_type: str
class TokenData(BaseModel):
email: Union[str, None] = None
class User(BaseModel):
id: int
email: str
name: Union[str, None] = None
surname: str
disabled: Union[bool, None] = False
items: list[Announcement] = []
class Config:
orm_mode = True
arbitrary_types_allowed=True
class UserInDB(User):
hashed_password: str
class Poem(BaseModel):
title: str
text: str
author: str