Skip to content

Commit

Permalink
API add/rm tags to services
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov committed Sep 3, 2024
1 parent c5a5a27 commit 22cc938
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
47 changes: 47 additions & 0 deletions api/specs/web-server/_catalog_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
# pylint: disable=unused-variable
# pylint: disable=too-many-arguments


from typing import Annotated

from fastapi import APIRouter, Depends
from models_library.api_schemas_webserver.projects import ProjectGet
from models_library.generics import Envelope
from simcore_service_webserver._meta import API_VTAG
from simcore_service_webserver.catalog._handlers import ServicePathParams

router = APIRouter(
prefix=f"/{API_VTAG}",
tags=[
"catalog",
"tags",
],
)


@router.put(
"/catalog/services/{service_key}/{service_version}/tags/{tag_id}",
response_model=Envelope[ProjectGet],
)
def add_service_tag(
_path_params: Annotated[ServicePathParams, Depends()],
tag_id: int,
):
"""
Adds a tag (needs access) to a service (need access)
"""


@router.delete(
"/catalog/services/{service_key}/{service_version}/tags/{tag_id}",
response_model=Envelope[ProjectGet],
)
def remove_service_tag(
_path_params: Annotated[ServicePathParams, Depends()],
tag_id: int,
):
"""
Adds a tag (needs access) from a service (need access)
"""
6 changes: 4 additions & 2 deletions api/specs/web-server/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
openapi_modules = [
importlib.import_module(name)
for name in (
# NOTE: order matters
"_activity",
"_admin",
"_announcements",
"_auth",
"_catalog",
"_catalog_tags",
"_cluster",
"_computations",
"_diagnostics",
Expand All @@ -31,8 +33,8 @@
"_nih_sparc_redirections",
"_nih_sparc",
"_products",
"_projects_comments",
"_projects_crud",
"_projects_comments",
"_projects_folders",
"_projects_groups",
"_projects_metadata",
Expand All @@ -46,8 +48,8 @@
"_resource_usage",
"_statics",
"_storage",
"_tags_groups",
"_tags",
"_tags_groups",
"_users",
"_version_control",
"_wallets",
Expand Down

0 comments on commit 22cc938

Please sign in to comment.