diff --git a/label_studio/users/api.py b/label_studio/users/api.py index b0b1d84735ce..28c05e43edc2 100644 --- a/label_studio/users/api.py +++ b/label_studio/users/api.py @@ -317,8 +317,8 @@ def get(self, request, *args, **kwargs): name='get', decorator=extend_schema( tags=['Users'], - summary='Retrieve my user', - description='Retrieve details of the account that you are using to access the API.', + summary='Whoami for current user', + description='Make the whoami call on behalf of the user you are using to access the API.', request=None, responses={200: WhoAmIUserSerializer}, extensions={ diff --git a/label_studio/users/serializers.py b/label_studio/users/serializers.py index 3181d7c8e947..6efa2a33140d 100644 --- a/label_studio/users/serializers.py +++ b/label_studio/users/serializers.py @@ -1,5 +1,7 @@ """This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license. """ +from typing import TypedDict + from core.utils.common import load_func from django.conf import settings from rest_flex_fields import FlexFieldsModelSerializer @@ -7,11 +9,18 @@ from users.models import User +class ActiveOrganizationMeta(TypedDict): + title: str + email: str + + class BaseUserSerializer(FlexFieldsModelSerializer): # short form for user presentation initials = serializers.SerializerMethodField(default='?', read_only=True) avatar = serializers.SerializerMethodField(read_only=True) - active_organization_meta = serializers.SerializerMethodField(read_only=True) + active_organization_meta = serializers.SerializerMethodField( + help_text='Active organization metadata', read_only=True + ) last_activity = serializers.DateTimeField(read_only=True, source='last_activity_cached') def get_avatar(self, instance): @@ -20,7 +29,7 @@ def get_avatar(self, instance): def get_initials(self, instance): return instance.get_initials(self._is_deleted(instance)) - def get_active_organization_meta(self, instance): + def get_active_organization_meta(self, instance) -> ActiveOrganizationMeta: organization = instance.active_organization if organization is None: return {'title': '', 'email': ''} diff --git a/poetry.lock b/poetry.lock index 5194a477f4c8..629ff7ca99f0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2130,13 +2130,13 @@ testing = ["pytest (>=6)", "pytest-black (>=0.3.7) ; platform_python_implementat [[package]] name = "label-studio-sdk" -version = "2.0.7" +version = "2.0.8" description = "" optional = false python-versions = ">=3.9,<4" groups = ["main"] files = [ - {file = "77b0c0abd2847c914096e6054b6f1b1805ee1b7a.zip", hash = "sha256:a29f9b9db793edfb97cbf384a2c9aac780656ca37893c998e412577f4e9277ad"}, + {file = "bb1b70dea95d5829b57021070ce5ccdd7ed60e47.zip", hash = "sha256:1c35fb3b96bfc7dce6f7a6755d7f4976e9169b086ec74ab7250a25d13c490385"}, ] [package.dependencies] @@ -2164,7 +2164,7 @@ xmljson = "0.2.1" [package.source] type = "url" -url = "https://github.com/HumanSignal/label-studio-sdk/archive/77b0c0abd2847c914096e6054b6f1b1805ee1b7a.zip" +url = "https://github.com/HumanSignal/label-studio-sdk/archive/bb1b70dea95d5829b57021070ce5ccdd7ed60e47.zip" [[package]] name = "launchdarkly-server-sdk" @@ -5109,4 +5109,4 @@ uwsgi = ["pyuwsgi", "uwsgitop"] [metadata] lock-version = "2.1" python-versions = ">=3.10,<4" -content-hash = "27d1096f39b9864ce20797fcaabcdf470de9b87aedf0b2bfe0b7b109096320a0" +content-hash = "20ef81501ff8769c6e999b65dd0c81f2a883fe97d2cecf78f3b9d608a34cb7ae" diff --git a/pyproject.toml b/pyproject.toml index cb1a83035a58..de8f88ef8302 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,7 +74,7 @@ dependencies = [ "tldextract (>=5.1.3)", "uuid-utils (>=0.11.0,<1.0.0)", ## HumanSignal repo dependencies :start - "label-studio-sdk @ https://github.com/HumanSignal/label-studio-sdk/archive/77b0c0abd2847c914096e6054b6f1b1805ee1b7a.zip", + "label-studio-sdk @ https://github.com/HumanSignal/label-studio-sdk/archive/bb1b70dea95d5829b57021070ce5ccdd7ed60e47.zip", ## HumanSignal repo dependencies :end ]