diff options
author | Frederick Muriuki Muriithi | 2025-07-03 12:17:56 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-07-03 12:17:56 -0500 |
commit | 09e27e96092f9a2e4f731709b8e8fdcd9835069a (patch) | |
tree | b8dd4cc569348e59ae1e54bc82c22564ca8cc115 /gn_auth | |
parent | 3f1842894dc9f984ec2186f64c7d6f7bba27205f (diff) | |
download | gn-auth-09e27e96092f9a2e4f731709b8e8fdcd9835069a.tar.gz |
Fix minor issues caught by mypy.
Diffstat (limited to 'gn_auth')
-rw-r--r-- | gn_auth/auth/authorisation/users/models.py | 5 | ||||
-rw-r--r-- | gn_auth/auth/authorisation/users/views.py | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/gn_auth/auth/authorisation/users/models.py b/gn_auth/auth/authorisation/users/models.py index 1b7d8e0..d30bfd0 100644 --- a/gn_auth/auth/authorisation/users/models.py +++ b/gn_auth/auth/authorisation/users/models.py @@ -1,6 +1,5 @@ """Functions for acting on users.""" import uuid -from typing import Union from functools import reduce from datetime import datetime, timedelta @@ -40,7 +39,7 @@ def __process_age_clause__(age_desc: str) -> tuple[str, int]: raise Exception("Invalid age descriptor.")# pylint: disable=[broad-exception-raised] -def __list_user_clauses_and_params__(**kwargs) -> tuple[str, dict[str, Union[int, str]]]: +def __list_user_clauses_and_params__(**kwargs) -> tuple[str, dict[str, str]]: """Process the WHERE clauses, and params for the 'LIST USERS' query.""" clauses = "" params = {} @@ -66,7 +65,7 @@ def __list_user_clauses_and_params__(**kwargs) -> tuple[str, dict[str, Union[int if bool(kwargs.get("age", "").strip()): _clause, _param = __process_age_clause__(kwargs["age"].strip()) clauses = clauses + (" AND " if len(clauses) > 0 else "") + _clause - params["created"] = _param + params["created"] = str(_param) return clauses, params diff --git a/gn_auth/auth/authorisation/users/views.py b/gn_auth/auth/authorisation/users/views.py index 4006dd6..55921ca 100644 --- a/gn_auth/auth/authorisation/users/views.py +++ b/gn_auth/auth/authorisation/users/views.py @@ -337,7 +337,11 @@ def list_all_users() -> Response: """List all the users.""" _kwargs = { key: value - for key, value in request.json.items() + for key, value in ( + request.json.items() if request.json + else { + "email": "", "name": "", "verified": "", "age": "" + }) if key in ("email", "name", "verified", "age") } |