chore: rename server to api (#7342)

This commit is contained in:
sriram veeraghanta 2025-07-04 15:32:21 +05:30 committed by GitHub
parent 6bee97eb26
commit fdbe4c2ca6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
554 changed files with 39 additions and 43 deletions

View file

@ -0,0 +1,28 @@
# Third party modules
from rest_framework import status
from rest_framework.response import Response
# Module imports
from plane.app.permissions import WorkspaceEntityPermission
from plane.app.serializers import WorkspaceEstimateSerializer
from plane.app.views.base import BaseAPIView
from plane.db.models import Estimate, Project
from plane.utils.cache import cache_response
class WorkspaceEstimatesEndpoint(BaseAPIView):
permission_classes = [WorkspaceEntityPermission]
@cache_response(60 * 60 * 2)
def get(self, request, slug):
estimate_ids = Project.objects.filter(
workspace__slug=slug, estimate__isnull=False
).values_list("estimate_id", flat=True)
estimates = (
Estimate.objects.filter(pk__in=estimate_ids, workspace__slug=slug)
.prefetch_related("points")
.select_related("workspace", "project")
)
serializer = WorkspaceEstimateSerializer(estimates, many=True)
return Response(serializer.data, status=status.HTTP_200_OK)