feat: project deploy board endpoint (#1943)

This commit is contained in:
Nikhil 2023-08-23 22:13:37 +05:30 committed by GitHub
parent 529ab19747
commit 7fca01d8c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 0 deletions

View File

@ -173,6 +173,7 @@ from plane.api.views import (
CommentReactionPublicViewSet, CommentReactionPublicViewSet,
InboxIssuePublicViewSet, InboxIssuePublicViewSet,
IssueVotePublicViewSet, IssueVotePublicViewSet,
WorkspaceProjectDeployBoardEndpoint,
## End Public Boards ## End Public Boards
## Exporter ## Exporter
ExportIssuesEndpoint, ExportIssuesEndpoint,
@ -1617,5 +1618,10 @@ urlpatterns = [
), ),
name="issue-vote-project-board", name="issue-vote-project-board",
), ),
path(
"public/workspaces/<str:slug>/project-boards/",
WorkspaceProjectDeployBoardEndpoint.as_view(),
name="workspace-project-boards",
),
## End Public Boards ## End Public Boards
] ]

View File

@ -16,6 +16,7 @@ from .project import (
ProjectDeployBoardViewSet, ProjectDeployBoardViewSet,
ProjectDeployBoardPublicSettingsEndpoint, ProjectDeployBoardPublicSettingsEndpoint,
ProjectMemberEndpoint, ProjectMemberEndpoint,
WorkspaceProjectDeployBoardEndpoint,
) )
from .user import ( from .user import (
UserEndpoint, UserEndpoint,

View File

@ -1286,3 +1286,38 @@ class ProjectDeployBoardIssuesPublicEndpoint(BaseAPIView):
{"error": "Something went wrong please try again later"}, {"error": "Something went wrong please try again later"},
status=status.HTTP_400_BAD_REQUEST, status=status.HTTP_400_BAD_REQUEST,
) )
class WorkspaceProjectDeployBoardEndpoint(BaseAPIView):
permission_classes = [AllowAny,]
def get(self, request, slug):
try:
projects = (
Project.objects.filter(workspace__slug=slug)
.annotate(
is_public=Exists(
ProjectDeployBoard.objects.filter(
workspace__slug=slug, project_id=OuterRef("pk")
)
)
)
.filter(is_public=True)
).values(
"id",
"identifier",
"name",
"description",
"emoji",
"icon_prop",
"cover_image",
)
return Response(projects, status=status.HTTP_200_OK)
except Exception as e:
capture_exception(e)
return Response(
{"error": "Something went wrong please try again later"},
status=status.HTTP_400_BAD_REQUEST,
)