You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

48 line
1.3 KiB

  1. from pydantic import BaseModel, Field
  2. from fastapi import Form, UploadFile
  3. from datetime import datetime
  4. from schemas.user import ShowDriver
  5. class CreateFuelingTask(BaseModel):
  6. VehicleId: int = Form(...)
  7. Description: str = Form(...)
  8. Date: datetime = Form(...)
  9. Cost: float = Form(...)
  10. FuelRefilled: float = Form(...)
  11. GasStationName: str = Form(...)
  12. ImageBefore: UploadFile = Form(...)
  13. ImageAfter: UploadFile = Form(...)
  14. model_config = {"arbitrary_types_allowed": True}
  15. class OutputFuelingTask(BaseModel):
  16. Id: int = Field(...)
  17. VehicleId: int = Field(...)
  18. Description: str = Field(...)
  19. Date: datetime = Field(...)
  20. Cost: float = Field(...)
  21. FuelRefilled: float = Field(...)
  22. GasStationName: str = Field(...)
  23. Driver: ShowDriver | None
  24. Creator: int | None
  25. ImageBefore: str = Field(...)
  26. ImageAfter: str = Field(...)
  27. model_config = {"arbitrary_types_allowed": True}
  28. class OutputFuelingTaskMin(BaseModel):
  29. Id: int = Field(...)
  30. VehicleId: int = Field(...)
  31. Description: str = Field(...)
  32. Date: datetime = Field(...)
  33. Cost: float = Field(...)
  34. Creator: int | None
  35. FuelRefilled: float = Field(...)
  36. GasStationName: str = Field(...)
  37. Driver: ShowDriver | None
  38. class OutputFuelingTaskList(BaseModel):
  39. FuelingTasks: list[OutputFuelingTaskMin]