Преглед изворни кода

Added creator to fuel output

main
Madiwka3 пре 1 година
родитељ
комит
9a0ec7a614
2 измењених фајлова са 4 додато и 0 уклоњено
  1. +2
    -0
      app/db/repository/fuelingtask.py
  2. +2
    -0
      app/schemas/fuelingtask.py

+ 2
- 0
app/db/repository/fuelingtask.py Прегледај датотеку

@@ -71,6 +71,7 @@ def get_fueling_task_by_id(fuel_task_id: int, db: Session):
imageafter = fuel_task.ImageAfter
imagebeforeBase64 = base64.b64encode(imagebefore).decode("ascii")
imageafterBase64 = base64.b64encode(imageafter).decode("ascii")
res["Creator"] = fuel_task.CreatedById
res["ImageBefore"] = imagebeforeBase64
res["ImageAfter"] = imageafterBase64
res["Driver"] = driver_obj
@@ -85,6 +86,7 @@ def get_all_fueling_tasks(db: Session):
res = task.__dict__
res["ImageBefore"] = ""
res["ImageAfter"] = ""
res["Creator"] = task.CreatedById
driver = get_user_by_id(task.DriverId, role="Driver", db=db)
driver_obj = driver.__dict__
res["Driver"] = driver_obj


+ 2
- 0
app/schemas/fuelingtask.py Прегледај датотеку

@@ -25,6 +25,7 @@ class OutputFuelingTask(BaseModel):
FuelRefilled: float = Field(...)
GasStationName: str = Field(...)
Driver: ShowDriver | None
Creator: int | None
ImageBefore: str = Field(...)
ImageAfter: str = Field(...)
model_config = {"arbitrary_types_allowed": True}
@@ -36,6 +37,7 @@ class OutputFuelingTaskMin(BaseModel):
Description: str = Field(...)
Date: datetime = Field(...)
Cost: float = Field(...)
Creator: int | None
FuelRefilled: float = Field(...)
GasStationName: str = Field(...)
Driver: ShowDriver | None


Loading…
Откажи
Сачувај