feat(db): update model to support JSON

This commit is contained in:
InfinityPacer
2024-09-30 03:07:33 +08:00
parent 7c643432ee
commit daadfcffd8
12 changed files with 20 additions and 39 deletions

View File

@@ -160,8 +160,6 @@ class Base:
def update(self, db: Session, payload: dict):
payload = {k: v for k, v in payload.items() if v is not None}
for key, value in payload.items():
if ObjectUtils.is_obj(value):
value = json.dumps(value)
setattr(self, key, value)
if inspect(self).detached:
db.add(self)