Skip to content

Commit

Permalink
Tweak API scheme.
Browse files Browse the repository at this point in the history
  • Loading branch information
amanning9 committed May 10, 2023
1 parent 2fedf7b commit 4d95b6b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion jasmin_services/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import django.contrib.auth
import django.db.models as dj_models
import django.utils.timezone
import drf_spectacular.types
import drf_spectacular.utils
import jasmin_django_utils.api.viewsets
import rest_framework.decorators as rf_decorators
Expand Down Expand Up @@ -38,7 +39,8 @@ class ServicesViewSet(
type=dt.date,
description="ISO Date on which you would like to know the active roles for a service.",
)
]
],
responses=serializers.RoleSerializer(many=True),
)
@rf_decorators.action(detail=True, required_scopes=["jasmin.services.serviceroles.all"])
def roles(self, request, pk=None):
Expand Down Expand Up @@ -84,6 +86,9 @@ class UsersViewSet(
action_serializers = {"services": serializers.ServiceListSerializer}
required_scopes = ["jasmin.services.userservices.all"]

@drf_spectacular.utils.extend_schema(
responses=serializers.ServiceListSerializer(many=True),
)
@rf_decorators.action(detail=True)
def services(self, request, username=None):
"""List the services of a given user."""
Expand Down

0 comments on commit 4d95b6b

Please sign in to comment.