diff --git a/apiserver/plane/api/urls.py b/apiserver/plane/api/urls.py index 8ebf10f57..a6beac693 100644 --- a/apiserver/plane/api/urls.py +++ b/apiserver/plane/api/urls.py @@ -173,6 +173,7 @@ from plane.api.views import ( CommentReactionPublicViewSet, InboxIssuePublicViewSet, IssueVotePublicViewSet, + WorkspaceProjectDeployBoardEndpoint, ## End Public Boards ## Exporter ExportIssuesEndpoint, @@ -1617,5 +1618,10 @@ urlpatterns = [ ), name="issue-vote-project-board", ), + path( + "public/workspaces//project-boards/", + WorkspaceProjectDeployBoardEndpoint.as_view(), + name="workspace-project-boards", + ), ## End Public Boards ] diff --git a/apiserver/plane/api/views/__init__.py b/apiserver/plane/api/views/__init__.py index 11223f90a..9572c552f 100644 --- a/apiserver/plane/api/views/__init__.py +++ b/apiserver/plane/api/views/__init__.py @@ -16,6 +16,7 @@ from .project import ( ProjectDeployBoardViewSet, ProjectDeployBoardPublicSettingsEndpoint, ProjectMemberEndpoint, + WorkspaceProjectDeployBoardEndpoint, ) from .user import ( UserEndpoint, diff --git a/apiserver/plane/api/views/project.py b/apiserver/plane/api/views/project.py index 6adee0016..a693d535b 100644 --- a/apiserver/plane/api/views/project.py +++ b/apiserver/plane/api/views/project.py @@ -1286,3 +1286,38 @@ class ProjectDeployBoardIssuesPublicEndpoint(BaseAPIView): {"error": "Something went wrong please try again later"}, 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, + )