Skip to content

Commit 86d9f68

Browse files
committed
webserver
1 parent 970a68f commit 86d9f68

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
from typing import TypedDict
1+
from typing import TypeAlias, TypedDict
2+
3+
from models_library.api_schemas_catalog.services import MyServicesRpcBatchGet
24

35

46
class ServiceKeyVersionDict(TypedDict):
57
key: str
68
version: str
9+
10+
11+
MyServicesBatchGetResult: TypeAlias = MyServicesRpcBatchGet

services/web/server/src/simcore_service_webserver/catalog/_service.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import Any, cast
44

55
from aiohttp import web
6-
from models_library.api_schemas_catalog.services import MyServiceGet, ServiceUpdateV2
6+
from models_library.api_schemas_catalog.services import ServiceUpdateV2
77
from models_library.api_schemas_webserver.catalog import (
88
ServiceInputGet,
99
ServiceInputKey,
@@ -37,6 +37,7 @@
3737
ServiceInputGetFactory,
3838
ServiceOutputGetFactory,
3939
)
40+
from ._models import MyServicesBatchGetResult
4041
from ._units_service import can_connect, replace_service_input_outputs
4142

4243
_logger = logging.getLogger(__name__)
@@ -97,7 +98,7 @@ async def batch_get_my_services(
9798
user_id: UserID,
9899
product_name: ProductName,
99100
services_ids: list[tuple[ServiceKey, ServiceVersion]],
100-
) -> list[MyServiceGet]:
101+
) -> MyServicesBatchGetResult:
101102
try:
102103

103104
return await catalog_rpc.batch_get_my_services(

services/web/server/src/simcore_service_webserver/projects/_controller/nodes_rest.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from models_library.api_schemas_catalog.service_access_rights import (
1010
ServiceAccessRightsGet,
1111
)
12-
from models_library.api_schemas_catalog.services import MyServiceGet
1312
from models_library.api_schemas_directorv2.dynamic_services import DynamicServiceGet
1413
from models_library.api_schemas_dynamic_scheduler.dynamic_services import (
1514
DynamicServiceStop,
@@ -547,19 +546,23 @@ async def get_project_services(request: web.Request) -> web.Response:
547546
)
548547
)
549548

550-
services: list[MyServiceGet] = await catalog_service.batch_get_my_services(
549+
batch_got = await catalog_service.batch_get_my_services(
551550
request.app,
552551
product_name=req_ctx.product_name,
553552
user_id=req_ctx.user_id,
554553
services_ids=services_in_project,
555554
)
556555

556+
#
557+
# FIXME: in "data" we return list[ProjectNodeServiceGet] that were found
558+
# in "error" we return list[ServiceKeyVersion] that were not found!
559+
# returned lists should keep the order of services_in_project
557560
return envelope_json_response(
558561
ProjectNodeServicesGet(
559562
project_uuid=path_params.project_id,
560563
services=[
561564
NodeServiceGet.model_validate(sv, from_attributes=True)
562-
for sv in services
565+
for sv in batch_got.found_items
563566
],
564567
)
565568
)

0 commit comments

Comments
 (0)