Skip to content

Commit 3a5c851

Browse files
committed
cleanup api
1 parent 71678a9 commit 3a5c851

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

api/specs/web-server/_workspaces.py

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,23 @@
99
from enum import Enum
1010
from typing import Annotated
1111

12-
from fastapi import APIRouter, Depends, Query, status
12+
from _common import as_query
13+
from fastapi import APIRouter, Depends, status
1314
from models_library.api_schemas_webserver.workspaces import (
1415
CreateWorkspaceBodyParams,
1516
PutWorkspaceBodyParams,
1617
WorkspaceGet,
1718
)
1819
from models_library.generics import Envelope
19-
from pydantic import Json
2020
from simcore_service_webserver._meta import API_VTAG
2121
from simcore_service_webserver.workspaces._groups_api import WorkspaceGroupGet
2222
from simcore_service_webserver.workspaces._models import (
23-
WorkspacesFilters,
2423
WorkspacesGroupsBodyParams,
2524
WorkspacesGroupsPathParams,
26-
WorkspacesOrderByJsonQueryParams,
25+
WorkspacesListQueryParams,
2726
WorkspacesPathParams,
2827
)
2928

30-
31-
class _ListQueryParams(WorkspacesOrderByJsonQueryParams):
32-
filters: Annotated[
33-
Json | None,
34-
Query(description=WorkspacesFilters.schema_json(indent=1)),
35-
] = None
36-
37-
3829
router = APIRouter(
3930
prefix=f"/{API_VTAG}",
4031
tags=[
@@ -49,7 +40,7 @@ class _ListQueryParams(WorkspacesOrderByJsonQueryParams):
4940
status_code=status.HTTP_201_CREATED,
5041
)
5142
async def create_workspace(
52-
_b: CreateWorkspaceBodyParams,
43+
_body: CreateWorkspaceBodyParams,
5344
):
5445
...
5546

@@ -59,7 +50,7 @@ async def create_workspace(
5950
response_model=Envelope[list[WorkspaceGet]],
6051
)
6152
async def list_workspaces(
62-
_q: Annotated[_ListQueryParams, Depends()],
53+
_query: Annotated[as_query(WorkspacesListQueryParams), Depends()],
6354
):
6455
...
6556

@@ -69,7 +60,7 @@ async def list_workspaces(
6960
response_model=Envelope[WorkspaceGet],
7061
)
7162
async def get_workspace(
72-
_p: Annotated[WorkspacesPathParams, Depends()],
63+
_path: Annotated[WorkspacesPathParams, Depends()],
7364
):
7465
...
7566

@@ -79,8 +70,8 @@ async def get_workspace(
7970
response_model=Envelope[WorkspaceGet],
8071
)
8172
async def replace_workspace(
82-
_p: Annotated[WorkspacesPathParams, Depends()],
83-
_b: PutWorkspaceBodyParams,
73+
_path: Annotated[WorkspacesPathParams, Depends()],
74+
_body: PutWorkspaceBodyParams,
8475
):
8576
...
8677

@@ -90,7 +81,7 @@ async def replace_workspace(
9081
status_code=status.HTTP_204_NO_CONTENT,
9182
)
9283
async def delete_workspace(
93-
_p: Annotated[WorkspacesPathParams, Depends()],
84+
_path: Annotated[WorkspacesPathParams, Depends()],
9485
):
9586
...
9687

@@ -106,8 +97,8 @@ async def delete_workspace(
10697
tags=_extra_tags,
10798
)
10899
async def create_workspace_group(
109-
_p: Annotated[WorkspacesGroupsPathParams, Depends()],
110-
_b: WorkspacesGroupsBodyParams,
100+
_path: Annotated[WorkspacesGroupsPathParams, Depends()],
101+
_body: WorkspacesGroupsBodyParams,
111102
):
112103
...
113104

@@ -118,7 +109,7 @@ async def create_workspace_group(
118109
tags=_extra_tags,
119110
)
120111
async def list_workspace_groups(
121-
_p: Annotated[WorkspacesPathParams, Depends()],
112+
_path: Annotated[WorkspacesPathParams, Depends()],
122113
):
123114
...
124115

@@ -129,8 +120,8 @@ async def list_workspace_groups(
129120
tags=_extra_tags,
130121
)
131122
async def replace_workspace_group(
132-
_p: Annotated[WorkspacesGroupsPathParams, Depends()],
133-
_b: WorkspacesGroupsBodyParams,
123+
_path: Annotated[WorkspacesGroupsPathParams, Depends()],
124+
_body: WorkspacesGroupsBodyParams,
134125
):
135126
...
136127

@@ -141,6 +132,6 @@ async def replace_workspace_group(
141132
tags=_extra_tags,
142133
)
143134
async def delete_workspace_group(
144-
_p: Annotated[WorkspacesGroupsPathParams, Depends()],
135+
_path: Annotated[WorkspacesGroupsPathParams, Depends()],
145136
):
146137
...

0 commit comments

Comments
 (0)