diff options
author | Frederick Muriuki Muriithi | 2024-05-30 12:31:47 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-06-03 10:02:08 -0500 |
commit | 5680eb5fd1053f695e5917891f916ae85c212d3e (patch) | |
tree | 26c030d67bb02e25005f1a420f4e05f77481f8fa /gn_auth/auth/authorisation | |
parent | 7c0ee01c1d134cbee0a2c8243dd55e4eeaaa5f7c (diff) | |
download | gn-auth-5680eb5fd1053f695e5917891f916ae85c212d3e.tar.gz |
Use asdict(...)
Use dataclasses.asdict function to generate the dict that will be used
for the response rather than building it up manually.
Diffstat (limited to 'gn_auth/auth/authorisation')
-rw-r--r-- | gn_auth/auth/authorisation/users/views.py | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/gn_auth/auth/authorisation/users/views.py b/gn_auth/auth/authorisation/users/views.py index 9ea0c59..feacae3 100644 --- a/gn_auth/auth/authorisation/users/views.py +++ b/gn_auth/auth/authorisation/users/views.py @@ -105,12 +105,7 @@ def register_user() -> Response: cursor, save_user( cursor, email["email"], user_name), password) assign_default_roles(cursor, user) - return jsonify( - { - "user_id": user.user_id, - "email": user.email, - "name": user.name - }) + return jsonify(asdict(user)) except sqlite3.IntegrityError as sq3ie: current_app.logger.debug(traceback.format_exc()) raise UserRegistrationError( |