mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 19:28:07 +00:00
Force refresh of updated_at value in db models.
This commit is contained in:
parent
a6c2a3e47f
commit
0113ca6673
@ -81,12 +81,14 @@ class ComputesRepository(BaseRepository):
|
|||||||
|
|
||||||
query = update(models.Compute).\
|
query = update(models.Compute).\
|
||||||
where(models.Compute.compute_id == compute_id).\
|
where(models.Compute.compute_id == compute_id).\
|
||||||
values(update_values).\
|
values(update_values)
|
||||||
execution_options(synchronize_session="fetch")
|
|
||||||
|
|
||||||
await self._db_session.execute(query)
|
await self._db_session.execute(query)
|
||||||
await self._db_session.commit()
|
await self._db_session.commit()
|
||||||
return await self.get_compute(compute_id)
|
compute_db = await self.get_compute(compute_id)
|
||||||
|
if compute_db:
|
||||||
|
await self._db_session.refresh(compute_db) # force refresh of updated_at value
|
||||||
|
return compute_db
|
||||||
|
|
||||||
async def delete_compute(self, compute_id: UUID) -> bool:
|
async def delete_compute(self, compute_id: UUID) -> bool:
|
||||||
|
|
||||||
|
@ -70,14 +70,16 @@ class TemplatesRepository(BaseRepository):
|
|||||||
|
|
||||||
update_values = template_update.dict(exclude_unset=True)
|
update_values = template_update.dict(exclude_unset=True)
|
||||||
|
|
||||||
query = not update(models.Template). \
|
query = update(models.Template). \
|
||||||
where(models.Template.template_id == template_id). \
|
where(models.Template.template_id == template_id). \
|
||||||
values(update_values).\
|
values(update_values)
|
||||||
execution_options(synchronize_session="fetch")
|
|
||||||
|
|
||||||
await self._db_session.execute(query)
|
await self._db_session.execute(query)
|
||||||
await self._db_session.commit()
|
await self._db_session.commit()
|
||||||
return await self.get_template(template_id)
|
template_db = await self.get_template(template_id)
|
||||||
|
if template_db:
|
||||||
|
await self._db_session.refresh(template_db) # force refresh of updated_at value
|
||||||
|
return template_db
|
||||||
|
|
||||||
async def delete_template(self, template_id: UUID) -> bool:
|
async def delete_template(self, template_id: UUID) -> bool:
|
||||||
|
|
||||||
|
@ -82,12 +82,14 @@ class UsersRepository(BaseRepository):
|
|||||||
|
|
||||||
query = update(models.User).\
|
query = update(models.User).\
|
||||||
where(models.User.user_id == user_id).\
|
where(models.User.user_id == user_id).\
|
||||||
values(update_values).\
|
values(update_values)
|
||||||
execution_options(synchronize_session="fetch")
|
|
||||||
|
|
||||||
await self._db_session.execute(query)
|
await self._db_session.execute(query)
|
||||||
await self._db_session.commit()
|
await self._db_session.commit()
|
||||||
return await self.get_user(user_id)
|
user_db = await self.get_user(user_id)
|
||||||
|
if user_db:
|
||||||
|
await self._db_session.refresh(user_db) # force refresh of updated_at value
|
||||||
|
return user_db
|
||||||
|
|
||||||
async def delete_user(self, user_id: UUID) -> bool:
|
async def delete_user(self, user_id: UUID) -> bool:
|
||||||
|
|
||||||
@ -156,12 +158,14 @@ class UsersRepository(BaseRepository):
|
|||||||
update_values = user_group_update.dict(exclude_unset=True)
|
update_values = user_group_update.dict(exclude_unset=True)
|
||||||
query = update(models.UserGroup).\
|
query = update(models.UserGroup).\
|
||||||
where(models.UserGroup.user_group_id == user_group_id).\
|
where(models.UserGroup.user_group_id == user_group_id).\
|
||||||
values(update_values).\
|
values(update_values)
|
||||||
execution_options(synchronize_session="fetch")
|
|
||||||
|
|
||||||
await self._db_session.execute(query)
|
await self._db_session.execute(query)
|
||||||
await self._db_session.commit()
|
await self._db_session.commit()
|
||||||
return await self.get_user_group(user_group_id)
|
user_group_db = await self.get_user_group(user_group_id)
|
||||||
|
if user_group_db:
|
||||||
|
await self._db_session.refresh(user_group_db) # force refresh of updated_at value
|
||||||
|
return user_group_db
|
||||||
|
|
||||||
async def delete_user_group(self, user_group_id: UUID) -> bool:
|
async def delete_user_group(self, user_group_id: UUID) -> bool:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user