Skip to content

Commit 9379260

Browse files
committed
adds get user
1 parent 4c074d7 commit 9379260

File tree

3 files changed

+63
-11
lines changed
  • api/specs/web-server
  • packages/models-library/src/models_library/api_schemas_webserver
  • services/web/server/src/simcore_service_webserver/api/v0

3 files changed

+63
-11
lines changed

api/specs/web-server/_users.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
MyTokenCreate,
1616
MyTokenGet,
1717
MyUserGet,
18+
MyUsersGetParams,
1819
MyUsersSearchQueryParams,
1920
UserGet,
2021
UsersSearchQueryParams,
@@ -47,7 +48,7 @@ async def get_my_profile():
4748
"/me",
4849
status_code=status.HTTP_204_NO_CONTENT,
4950
)
50-
async def update_my_profile(_profile: MyProfilePatch):
51+
async def update_my_profile(_body: MyProfilePatch):
5152
...
5253

5354

@@ -57,7 +58,7 @@ async def update_my_profile(_profile: MyProfilePatch):
5758
deprecated=True,
5859
description="Use PATCH instead",
5960
)
60-
async def replace_my_profile(_profile: MyProfilePatch):
61+
async def replace_my_profile(_body: MyProfilePatch):
6162
...
6263

6364

@@ -67,7 +68,7 @@ async def replace_my_profile(_profile: MyProfilePatch):
6768
)
6869
async def set_frontend_preference(
6970
preference_id: PreferenceIdentifier,
70-
body_item: PatchRequestBody,
71+
_body: PatchRequestBody,
7172
):
7273
...
7374

@@ -85,23 +86,25 @@ async def list_tokens():
8586
response_model=Envelope[MyTokenGet],
8687
status_code=status.HTTP_201_CREATED,
8788
)
88-
async def create_token(_token: MyTokenCreate):
89+
async def create_token(_body: MyTokenCreate):
8990
...
9091

9192

9293
@router.get(
9394
"/me/tokens/{service}",
9495
response_model=Envelope[MyTokenGet],
9596
)
96-
async def get_token(_params: Annotated[_TokenPathParams, Depends()]):
97+
async def get_token(
98+
_path: Annotated[_TokenPathParams, Depends()],
99+
):
97100
...
98101

99102

100103
@router.delete(
101104
"/me/tokens/{service}",
102105
status_code=status.HTTP_204_NO_CONTENT,
103106
)
104-
async def delete_token(_params: Annotated[_TokenPathParams, Depends()]):
107+
async def delete_token(_path: Annotated[_TokenPathParams, Depends()]):
105108
...
106109

107110

@@ -117,7 +120,9 @@ async def list_user_notifications():
117120
"/me/notifications",
118121
status_code=status.HTTP_204_NO_CONTENT,
119122
)
120-
async def create_user_notification(_notification: UserNotificationCreate):
123+
async def create_user_notification(
124+
_body: UserNotificationCreate,
125+
):
121126
...
122127

123128

@@ -126,8 +131,8 @@ async def create_user_notification(_notification: UserNotificationCreate):
126131
status_code=status.HTTP_204_NO_CONTENT,
127132
)
128133
async def mark_notification_as_read(
129-
_params: Annotated[_NotificationPathParams, Depends()],
130-
_notification: UserNotificationPatch,
134+
_path: Annotated[_NotificationPathParams, Depends()],
135+
_body: UserNotificationPatch,
131136
):
132137
...
133138

@@ -140,12 +145,20 @@ async def list_user_permissions():
140145
...
141146

142147

148+
@router.get(
149+
"/me/users/{user_id}",
150+
response_model=Envelope[MyUserGet],
151+
)
152+
async def get_user(_path: Annotated[MyUsersGetParams, Depends()]):
153+
...
154+
155+
143156
@router.get(
144157
"/me/users:search",
145158
response_model=Envelope[list[MyUserGet]],
146159
description="Search among users who are publicly visible to the caller (i.e., me) based on their privacy settings.",
147160
)
148-
async def search_users(_params: Annotated[MyUsersSearchQueryParams, Depends()]):
161+
async def search_users(_query: Annotated[MyUsersSearchQueryParams, Depends()]):
149162
...
150163

151164

@@ -157,7 +170,7 @@ async def search_users(_params: Annotated[MyUsersSearchQueryParams, Depends()]):
157170
response_model=Envelope[list[UserGet]],
158171
tags=_extra_tags,
159172
)
160-
async def search_users_as_admin(_params: Annotated[UsersSearchQueryParams, Depends()]):
173+
async def search_users_as_admin(_query: Annotated[UsersSearchQueryParams, Depends()]):
161174
# NOTE: see `Search` in `Common Custom Methods` in https://cloud.google.com/apis/design/custom_methods
162175
...
163176

packages/models-library/src/models_library/api_schemas_webserver/users.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ def _validate_user_name(cls, value: str):
196196
#
197197

198198

199+
class MyUsersGetParams(BaseModel):
200+
user_id: UserID
201+
202+
199203
class MyUsersSearchQueryParams(BaseModel):
200204
match_: Annotated[
201205
str,

services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,28 @@ paths:
13231323
application/json:
13241324
schema:
13251325
$ref: '#/components/schemas/Envelope_list_MyPermissionGet__'
1326+
/v0/me/users/{user_id}:
1327+
get:
1328+
tags:
1329+
- user
1330+
summary: Get User
1331+
operationId: get_user
1332+
parameters:
1333+
- name: user_id
1334+
in: path
1335+
required: true
1336+
schema:
1337+
type: integer
1338+
exclusiveMinimum: true
1339+
title: User Id
1340+
minimum: 0
1341+
responses:
1342+
'200':
1343+
description: Successful Response
1344+
content:
1345+
application/json:
1346+
schema:
1347+
$ref: '#/components/schemas/Envelope_MyUserGet_'
13261348
/v0/me/users:search:
13271349
get:
13281350
tags:
@@ -8231,6 +8253,19 @@ components:
82318253
title: Error
82328254
type: object
82338255
title: Envelope[MyTokenGet]
8256+
Envelope_MyUserGet_:
8257+
properties:
8258+
data:
8259+
anyOf:
8260+
- $ref: '#/components/schemas/MyUserGet'
8261+
- type: 'null'
8262+
error:
8263+
anyOf:
8264+
- {}
8265+
- type: 'null'
8266+
title: Error
8267+
type: object
8268+
title: Envelope[MyUserGet]
82348269
Envelope_NodeCreated_:
82358270
properties:
82368271
data:

0 commit comments

Comments
 (0)