base context for wrappers updated
This commit is contained in:
@@ -281,19 +281,16 @@ class Build(CrudCollection, SelectActionWithEmployee):
|
||||
def update_action(cls, data: UpdateBuild, build_uu_id: str, token):
|
||||
from Schemas import Addresses
|
||||
|
||||
print("data_dict", data.dump())
|
||||
data_dict = data.excluded_dump()
|
||||
db = Addresses.new_session()
|
||||
if data.address_uu_id:
|
||||
official_address = Addresses.filter_one(
|
||||
Addresses.uu_id == data.address_uu_id
|
||||
).data
|
||||
Addresses.uu_id == data.address_uu_id, db=db
|
||||
).first
|
||||
data_dict["address_id"] = official_address.id if official_address else None
|
||||
print("data_dict", data_dict)
|
||||
if build_to_update := cls.filter_one(cls.uu_id == build_uu_id).data:
|
||||
print("build_to_update", build_to_update.get_dict())
|
||||
if build_to_update := cls.filter_one(cls.uu_id == build_uu_id, db=db).first:
|
||||
updated_build = build_to_update.update(**data_dict)
|
||||
updated_build.save()
|
||||
print("updated_build", updated_build.get_dict())
|
||||
return updated_build
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user