diff --git a/mdrsclient/api/user.py b/mdrsclient/api/user.py index 81c34d4..9b98cd8 100644 --- a/mdrsclient/api/user.py +++ b/mdrsclient/api/user.py @@ -11,8 +11,9 @@ from mdrsclient.models import Token, User @dataclass(frozen=True) class UserAuthResponse(Token): - laboratory: str - lab_id: int + is_reviewer: bool | None = None + laboratory: str | None = None + lab_id: int | None = None class UserApi(BaseApi): @@ -28,7 +29,9 @@ class UserApi(BaseApi): self._raise_response_error(response) obj = parse_obj_as(UserAuthResponse, response.json()) token = Token(access=obj.access, refresh=obj.refresh) - user = User(id=token.user_id, username=username, laboratory_id=obj.lab_id, laboratory=obj.laboratory) + laboratory_ids = [obj.lab_id] if obj.lab_id is not None else [] + is_reviewer = obj.is_reviewer if obj.is_reviewer is not None else False + user = User(id=token.user_id, username=username, laboratory_ids=laboratory_ids, is_reviewer=is_reviewer) return (user, token) def refresh(self, token: Token) -> Token: diff --git a/mdrsclient/models/user.py b/mdrsclient/models/user.py index c73cdb4..a968a52 100644 --- a/mdrsclient/models/user.py +++ b/mdrsclient/models/user.py @@ -46,5 +46,5 @@ class Token: class User: id: int username: str - laboratory_id: int - laboratory: str + laboratory_ids: list[int] + is_reviewer: bool