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.

fuelingtask.py 1.3 KiB

1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. ImageBefore: str = Field(...)
  25. ImageAfter: str = Field(...)
  26. model_config = {"arbitrary_types_allowed": True}
  27. class OutputFuelingTaskMin(BaseModel):
  28. Id: int = Field(...)
  29. VehicleId: int = Field(...)
  30. Description: str = Field(...)
  31. Date: datetime = Field(...)
  32. Cost: float = Field(...)
  33. FuelRefilled: float = Field(...)
  34. GasStationName: str = Field(...)
  35. Driver: ShowDriver | None
  36. class OutputFuelingTaskList(BaseModel):
  37. FuelingTasks: list[OutputFuelingTaskMin]