1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-10-07 15:33:51 +03:00

Refactor save_item methods to return item IDs and update get_real_name logic in user registration

This commit is contained in:
Adolfo Gómez García
2025-02-14 17:13:07 +01:00
parent a10f05766d
commit f3a8335998
11 changed files with 56 additions and 28 deletions

View File

@@ -140,7 +140,7 @@ class Services(DetailHandler): # pylint: disable=too-many-public-methods
except Exception: # nosec: This is a delete, we don't care about exceptions
pass
def save_item(self, parent: 'Model', item: typing.Optional[str]) -> None:
def save_item(self, parent: 'Model', item: typing.Optional[str]) -> typing.Any:
parent = ensure.is_instance(parent, models.Provider)
# Extract item db fields
# We need this fields for all
@@ -187,6 +187,7 @@ class Services(DetailHandler): # pylint: disable=too-many-public-methods
service.data = service_instance.serialize()
service.save()
return {'id': service.uuid}
except models.Service.DoesNotExist:
raise self.invalid_item_response() from None
except IntegrityError as e: # Duplicate key probably