|
7 | 7 | from enum import Enum |
8 | 8 | from typing import Annotated |
9 | 9 |
|
| 10 | +from _common import as_query |
10 | 11 | from fastapi import APIRouter, Depends, status |
11 | 12 | from models_library.api_schemas_webserver.users import ( |
12 | 13 | MyPermissionGet, |
13 | 14 | MyProfileGet, |
14 | 15 | MyProfilePatch, |
15 | 16 | MyTokenCreate, |
16 | 17 | MyTokenGet, |
17 | | - UserForAdminGet, |
| 18 | + UserAccountApprove, |
| 19 | + UserAccountGet, |
| 20 | + UserAccountReject, |
| 21 | + UserAccountSearchQueryParams, |
18 | 22 | UserGet, |
19 | | - UsersForAdminSearchQueryParams, |
| 23 | + UsersAccountListQueryParams, |
20 | 24 | UsersSearch, |
21 | 25 | ) |
22 | 26 | from models_library.api_schemas_webserver.users_preferences import PatchRequestBody |
23 | 27 | from models_library.generics import Envelope |
| 28 | +from models_library.rest_pagination import Page |
24 | 29 | from models_library.user_preferences import PreferenceIdentifier |
25 | 30 | from simcore_service_webserver._meta import API_VTAG |
26 | 31 | from simcore_service_webserver.users._common.schemas import PreRegisteredUserGet |
@@ -144,20 +149,46 @@ async def search_users(_body: UsersSearch): ... |
144 | 149 |
|
145 | 150 |
|
146 | 151 | @router.get( |
147 | | - "/admin/users:search", |
148 | | - response_model=Envelope[list[UserForAdminGet]], |
| 152 | + "/admin/user-accounts", |
| 153 | + response_model=Page[UserAccountGet], |
149 | 154 | tags=_extra_tags, |
150 | 155 | ) |
151 | | -async def search_users_for_admin( |
152 | | - _query: Annotated[UsersForAdminSearchQueryParams, Depends()], |
| 156 | +async def list_users_accounts( |
| 157 | + _query: Annotated[as_query(UsersAccountListQueryParams), Depends()], |
| 158 | +): ... |
| 159 | + |
| 160 | + |
| 161 | +@router.post( |
| 162 | + "/admin/user-accounts:approve", |
| 163 | + status_code=status.HTTP_204_NO_CONTENT, |
| 164 | + tags=_extra_tags, |
| 165 | +) |
| 166 | +async def approve_user_account(_body: UserAccountApprove): ... |
| 167 | + |
| 168 | + |
| 169 | +@router.post( |
| 170 | + "/admin/user-accounts:reject", |
| 171 | + status_code=status.HTTP_204_NO_CONTENT, |
| 172 | + tags=_extra_tags, |
| 173 | +) |
| 174 | +async def reject_user_account(_body: UserAccountReject): ... |
| 175 | + |
| 176 | + |
| 177 | +@router.get( |
| 178 | + "/admin/user-accounts:search", |
| 179 | + response_model=Envelope[list[UserAccountGet]], |
| 180 | + tags=_extra_tags, |
| 181 | +) |
| 182 | +async def search_user_accounts( |
| 183 | + _query: Annotated[UserAccountSearchQueryParams, Depends()], |
153 | 184 | ): |
154 | 185 | # NOTE: see `Search` in `Common Custom Methods` in https://cloud.google.com/apis/design/custom_methods |
155 | 186 | ... |
156 | 187 |
|
157 | 188 |
|
158 | 189 | @router.post( |
159 | | - "/admin/users:pre-register", |
160 | | - response_model=Envelope[UserForAdminGet], |
| 190 | + "/admin/user-accounts:pre-register", |
| 191 | + response_model=Envelope[UserAccountGet], |
161 | 192 | tags=_extra_tags, |
162 | 193 | ) |
163 | | -async def pre_register_user_for_admin(_body: PreRegisteredUserGet): ... |
| 194 | +async def pre_register_user_account(_body: PreRegisteredUserGet): ... |
0 commit comments