mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 07:11:13 +02:00
Pydantic v2 migration
This commit is contained in:
1 parent
11f51b3809
commit
9c456532d0
46 files changed
+221
-277
No files matched your search
@@ -68,7 +68,7 @@ class ComputesRepository(BaseRepository):
|
||||
|
||||
async def update_compute(self, compute_id: UUID, compute_update: schemas.ComputeUpdate) -> Optional[models.Compute]:
|
||||
|
||||
update_values = compute_update.dict(exclude_unset=True)
|
||||
update_values = compute_update.model_dump(exclude_unset=True)
|
||||
|
||||
password = compute_update.password
|
||||
if password:
|
||||
|
||||
@@ -93,7 +93,7 @@ class RbacRepository(BaseRepository):
|
||||
Update a role.
|
||||
"""
|
||||
|
||||
update_values = role_update.dict(exclude_unset=True)
|
||||
update_values = role_update.model_dump(exclude_unset=True)
|
||||
query = update(models.Role).\
|
||||
where(models.Role.role_id == role_id).\
|
||||
values(update_values)
|
||||
@@ -236,7 +236,7 @@ class RbacRepository(BaseRepository):
|
||||
Update a permission.
|
||||
"""
|
||||
|
||||
update_values = permission_update.dict(exclude_unset=True)
|
||||
update_values = permission_update.model_dump(exclude_unset=True)
|
||||
query = update(models.Permission).\
|
||||
where(models.Permission.permission_id == permission_id).\
|
||||
values(update_values)
|
||||
|
||||
@@ -97,7 +97,7 @@ class UsersRepository(BaseRepository):
|
||||
Update an user.
|
||||
"""
|
||||
|
||||
update_values = user_update.dict(exclude_unset=True)
|
||||
update_values = user_update.model_dump(exclude_unset=True)
|
||||
password = update_values.pop("password", None)
|
||||
if password:
|
||||
update_values["hashed_password"] = self._auth_service.hash_password(password=password.get_secret_value())
|
||||
@@ -207,10 +207,10 @@ class UsersRepository(BaseRepository):
|
||||
user_group_update: schemas.UserGroupUpdate
|
||||
) -> Optional[models.UserGroup]:
|
||||
"""
|
||||
Update an user group.
|
||||
Update a user group.
|
||||
"""
|
||||
|
||||
update_values = user_group_update.dict(exclude_unset=True)
|
||||
update_values = user_group_update.model_dump(exclude_unset=True)
|
||||
query = update(models.UserGroup).\
|
||||
where(models.UserGroup.user_group_id == user_group_id).\
|
||||
values(update_values)
|
||||
@@ -224,7 +224,7 @@ class UsersRepository(BaseRepository):
|
||||
|
||||
async def delete_user_group(self, user_group_id: UUID) -> bool:
|
||||
"""
|
||||
Delete an user group.
|
||||
Delete a user group.
|
||||
"""
|
||||
|
||||
query = delete(models.UserGroup).where(models.UserGroup.user_group_id == user_group_id)
|
||||
|
||||
Reference in new issue
Block a user