2022-08-01 10:40:40 +00:00
|
|
|
"""Users"""
|
2024-06-10 01:52:26 +00:00
|
|
|
|
2022-08-01 10:40:40 +00:00
|
|
|
# pylint: disable=too-few-public-methods
|
|
|
|
import typing
|
|
|
|
import strawberry
|
|
|
|
|
|
|
|
from selfprivacy_api.graphql.common_types.user import (
|
|
|
|
User,
|
|
|
|
get_user_by_username,
|
2022-08-25 17:03:56 +00:00
|
|
|
get_users,
|
2022-08-01 10:40:40 +00:00
|
|
|
)
|
|
|
|
from selfprivacy_api.graphql import IsAuthenticated
|
|
|
|
|
|
|
|
|
|
|
|
@strawberry.type
|
|
|
|
class Users:
|
|
|
|
@strawberry.field(permission_classes=[IsAuthenticated])
|
|
|
|
def get_user(self, username: str) -> typing.Optional[User]:
|
|
|
|
"""Get users"""
|
|
|
|
return get_user_by_username(username)
|
|
|
|
|
|
|
|
all_users: typing.List[User] = strawberry.field(
|
|
|
|
permission_classes=[IsAuthenticated], resolver=get_users
|
|
|
|
)
|