Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
EricHasegawa committed Sep 12, 2023
1 parent 060a582 commit 6a05002
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions src/sentry/api/endpoints/release_threshold_details.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.http import HttpResponse
from rest_framework import serializers
from rest_framework.request import Request
from rest_framework.response import Response

Expand All @@ -8,16 +7,10 @@
from sentry.api.base import region_silo_endpoint
from sentry.api.bases.project import ProjectEndpoint
from sentry.api.serializers import serialize
from sentry.api.serializers.rest_framework.project import ProjectField
from sentry.models import Project
from sentry.models.release_threshold.releasethreshold import ReleaseThreshold


class ReleaseThresholdDetailsGETSerializer(serializers.Serializer):
threshold_id = serializers.CharField()
project = ProjectField()


@region_silo_endpoint
class ReleaseThresholdDetailsEndpoint(ProjectEndpoint):
owner: ApiOwner = ApiOwner.ENTERPRISE
Expand All @@ -26,21 +19,9 @@ class ReleaseThresholdDetailsEndpoint(ProjectEndpoint):
}

def get(self, request: Request, project: Project, threshold_id: str) -> HttpResponse:
request.data["project"] = project.slug
request.data["threshold_id"] = threshold_id
serializer = ReleaseThresholdDetailsGETSerializer(
data=request.data,
context={
"organization": project.organization,
"access": request.access,
},
)
if not serializer.is_valid():
return Response(serializer.errors, status=400)
result = serializer.validated_data
try:
release_threshold = ReleaseThreshold.objects.get(
id=result.get("threshold_id"),
id=threshold_id,
project=project,
)
return Response(serialize(release_threshold, request.user), status=200)
Expand Down

0 comments on commit 6a05002

Please sign in to comment.