99from enum import Enum
1010from 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
1314from models_library .api_schemas_webserver .workspaces import (
1415 CreateWorkspaceBodyParams ,
1516 PutWorkspaceBodyParams ,
1617 WorkspaceGet ,
1718)
1819from models_library .generics import Envelope
19- from pydantic import Json
2020from simcore_service_webserver ._meta import API_VTAG
2121from simcore_service_webserver .workspaces ._groups_api import WorkspaceGroupGet
2222from 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-
3829router = APIRouter (
3930 prefix = f"/{ API_VTAG } " ,
4031 tags = [
@@ -49,7 +40,7 @@ class _ListQueryParams(WorkspacesOrderByJsonQueryParams):
4940 status_code = status .HTTP_201_CREATED ,
5041)
5142async 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)
6152async 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)
7162async 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)
8172async 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)
9283async 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)
10899async 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)
120111async 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)
131122async 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)
143134async def delete_workspace_group (
144- _p : Annotated [WorkspacesGroupsPathParams , Depends ()],
135+ _path : Annotated [WorkspacesGroupsPathParams , Depends ()],
145136):
146137 ...
0 commit comments