alchemy flush and save functions updated

This commit is contained in:
2024-11-11 18:58:28 +03:00
parent 1f1222c32d
commit f6135ced5f
6 changed files with 4 additions and 14 deletions

View File

@@ -24,11 +24,11 @@ class FilterAttributes:
FilterModel = ListOptions
def flush(self):
from fastapi import status
"""Flush the current session."""
try:
self.__session__.add(self)
self.__session__.flush()
return self
except SQLAlchemyError as e:
self.raise_http_exception(
status_code="HTTP_400_BAD_REQUEST",
@@ -47,6 +47,7 @@ class FilterAttributes:
"""Saves the updated model to the current entity db."""
try:
cls.__session__.commit()
return cls
except SQLAlchemyError as e:
cls.raise_http_exception(
status_code="HTTP_400_BAD_REQUEST",