mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-12 19:38:57 +00:00
Use synchronize_session="fetch" when updating values.
This commit is contained in:
parent
91b0534182
commit
a6c2a3e47f
@ -79,7 +79,10 @@ class ComputesRepository(BaseRepository):
|
||||
if password:
|
||||
update_values["password"] = password.get_secret_value()
|
||||
|
||||
query = update(models.Compute).where(models.Compute.compute_id == compute_id).values(update_values)
|
||||
query = update(models.Compute).\
|
||||
where(models.Compute.compute_id == compute_id).\
|
||||
values(update_values).\
|
||||
execution_options(synchronize_session="fetch")
|
||||
|
||||
await self._db_session.execute(query)
|
||||
await self._db_session.commit()
|
||||
|
@ -70,7 +70,10 @@ class TemplatesRepository(BaseRepository):
|
||||
|
||||
update_values = template_update.dict(exclude_unset=True)
|
||||
|
||||
query = update(models.Template).where(models.Template.template_id == template_id).values(update_values)
|
||||
query = not update(models.Template). \
|
||||
where(models.Template.template_id == template_id). \
|
||||
values(update_values).\
|
||||
execution_options(synchronize_session="fetch")
|
||||
|
||||
await self._db_session.execute(query)
|
||||
await self._db_session.commit()
|
||||
|
@ -80,7 +80,10 @@ class UsersRepository(BaseRepository):
|
||||
if password:
|
||||
update_values["hashed_password"] = self._auth_service.hash_password(password=password.get_secret_value())
|
||||
|
||||
query = update(models.User).where(models.User.user_id == user_id).values(update_values)
|
||||
query = update(models.User).\
|
||||
where(models.User.user_id == user_id).\
|
||||
values(update_values).\
|
||||
execution_options(synchronize_session="fetch")
|
||||
|
||||
await self._db_session.execute(query)
|
||||
await self._db_session.commit()
|
||||
@ -151,7 +154,10 @@ class UsersRepository(BaseRepository):
|
||||
) -> Optional[models.UserGroup]:
|
||||
|
||||
update_values = user_group_update.dict(exclude_unset=True)
|
||||
query = update(models.UserGroup).where(models.UserGroup.user_group_id == user_group_id).values(update_values)
|
||||
query = update(models.UserGroup).\
|
||||
where(models.UserGroup.user_group_id == user_group_id).\
|
||||
values(update_values).\
|
||||
execution_options(synchronize_session="fetch")
|
||||
|
||||
await self._db_session.execute(query)
|
||||
await self._db_session.commit()
|
||||
|
Loading…
Reference in New Issue
Block a user