from pydantic import BaseModel from typing import Annotated, Union from datetime import date from typing import List from fastapi import UploadFile, Form 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: Union[int, None] = 0 #статус бронирования (либо 0, либо айди бронирующего) obsolete: bool class Config: orm_mode = True arbitrary_types_allowed=True class Token(BaseModel): access_token: str # token_type: str class TokenData(BaseModel): user_id: Union[int, None] = None class User(BaseModel): id: int nickname: str reg_date: date disabled: Union[bool, None] = False items: list[Announcement] = [] points: int class Config: orm_mode = True arbitrary_types_allowed=True class UserInDB(User): hashed_password: str class Poem(BaseModel): id: int title: str text: str author: str class Config: orm_mode = True # Для "/api/trashbox" class TrashboxBase(BaseModel): Lat: float Lng: float class TrashboxResponse(TrashboxBase): Name: str Address: str Categories: list[str] class TrashboxRequest(TrashboxBase): Category: str # Для /api/announcement/dispose class TrashboxSelected(BaseModel): Lat: float Lng: float Name: str Address: str Category: str class DisposeRequest(BaseModel): ann_id: int trashbox: TrashboxSelected # схема для передачи параметров, по которым ведется фильтрация class SortAnnouncements(BaseModel): obsolete: Union[int, None] = False user_id: Union[int, None] = None metro: Union[str, None] = None category: Union[str, None] = None # booked_by: Union[int, None] = None # схема для начисления баллов class AddRating(BaseModel): user_id: int rate: int