mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: endpoint changes
This commit is contained in:
parent
bd58931690
commit
9f36d8158a
@ -674,7 +674,8 @@ class DeployBoardViewSet(BaseViewSet):
|
|||||||
)
|
)
|
||||||
|
|
||||||
project_deploy_board, _ = DeployBoard.objects.get_or_create(
|
project_deploy_board, _ = DeployBoard.objects.get_or_create(
|
||||||
anchor=f"{slug}/{project_id}",
|
entity_name="project",
|
||||||
|
entity_identifier=project_id,
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
)
|
)
|
||||||
project_deploy_board.comments = comments
|
project_deploy_board.comments = comments
|
||||||
|
@ -10,7 +10,7 @@ from plane.space.views import (
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/project-boards/<uuid:project_id>/inboxes/<uuid:inbox_id>/inbox-issues/",
|
"anchor/<uuid:anchor_id>/inboxes/<uuid:inbox_id>/inbox-issues/",
|
||||||
InboxIssuePublicViewSet.as_view(
|
InboxIssuePublicViewSet.as_view(
|
||||||
{
|
{
|
||||||
"get": "list",
|
"get": "list",
|
||||||
@ -20,7 +20,7 @@ urlpatterns = [
|
|||||||
name="inbox-issue",
|
name="inbox-issue",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/project-boards/<uuid:project_id>/inboxes/<uuid:inbox_id>/inbox-issues/<uuid:pk>/",
|
"anchor/<uuid:anchor_id>/inboxes/<uuid:inbox_id>/inbox-issues/<uuid:pk>/",
|
||||||
InboxIssuePublicViewSet.as_view(
|
InboxIssuePublicViewSet.as_view(
|
||||||
{
|
{
|
||||||
"get": "retrieve",
|
"get": "retrieve",
|
||||||
@ -31,7 +31,7 @@ urlpatterns = [
|
|||||||
name="inbox-issue",
|
name="inbox-issue",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/project-boards/<uuid:project_id>/issues/<uuid:issue_id>/votes/",
|
"anchor/<uuid:anchor_id>/issues/<uuid:issue_id>/votes/",
|
||||||
IssueVotePublicViewSet.as_view(
|
IssueVotePublicViewSet.as_view(
|
||||||
{
|
{
|
||||||
"get": "list",
|
"get": "list",
|
||||||
|
@ -10,12 +10,12 @@ from plane.space.views import (
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/project-boards/<uuid:project_id>/issues/<uuid:issue_id>/",
|
"anchor/<uuid:anchor_id>/issues/<uuid:issue_id>/",
|
||||||
IssueRetrievePublicEndpoint.as_view(),
|
IssueRetrievePublicEndpoint.as_view(),
|
||||||
name="workspace-project-boards",
|
name="workspace-project-boards",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/project-boards/<uuid:project_id>/issues/<uuid:issue_id>/comments/",
|
"anchor/<uuid:anchor_id>/issues/<uuid:issue_id>/comments/",
|
||||||
IssueCommentPublicViewSet.as_view(
|
IssueCommentPublicViewSet.as_view(
|
||||||
{
|
{
|
||||||
"get": "list",
|
"get": "list",
|
||||||
@ -25,7 +25,7 @@ urlpatterns = [
|
|||||||
name="issue-comments-project-board",
|
name="issue-comments-project-board",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/project-boards/<uuid:project_id>/issues/<uuid:issue_id>/comments/<uuid:pk>/",
|
"anchor/<uuid:anchor_id>/issues/<uuid:issue_id>/comments/<uuid:pk>/",
|
||||||
IssueCommentPublicViewSet.as_view(
|
IssueCommentPublicViewSet.as_view(
|
||||||
{
|
{
|
||||||
"get": "retrieve",
|
"get": "retrieve",
|
||||||
@ -36,7 +36,7 @@ urlpatterns = [
|
|||||||
name="issue-comments-project-board",
|
name="issue-comments-project-board",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/project-boards/<uuid:project_id>/issues/<uuid:issue_id>/reactions/",
|
"anchor/<uuid:anchor_id>/issues/<uuid:issue_id>/reactions/",
|
||||||
IssueReactionPublicViewSet.as_view(
|
IssueReactionPublicViewSet.as_view(
|
||||||
{
|
{
|
||||||
"get": "list",
|
"get": "list",
|
||||||
@ -46,7 +46,7 @@ urlpatterns = [
|
|||||||
name="issue-reactions-project-board",
|
name="issue-reactions-project-board",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/project-boards/<uuid:project_id>/issues/<uuid:issue_id>/reactions/<str:reaction_code>/",
|
"anchor/<uuid:anchor_id>/issues/<uuid:issue_id>/reactions/<str:reaction_code>/",
|
||||||
IssueReactionPublicViewSet.as_view(
|
IssueReactionPublicViewSet.as_view(
|
||||||
{
|
{
|
||||||
"delete": "destroy",
|
"delete": "destroy",
|
||||||
@ -55,7 +55,7 @@ urlpatterns = [
|
|||||||
name="issue-reactions-project-board",
|
name="issue-reactions-project-board",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/project-boards/<uuid:project_id>/comments/<uuid:comment_id>/reactions/",
|
"anchor/<uuid:anchor_id>/comments/<uuid:comment_id>/reactions/",
|
||||||
CommentReactionPublicViewSet.as_view(
|
CommentReactionPublicViewSet.as_view(
|
||||||
{
|
{
|
||||||
"get": "list",
|
"get": "list",
|
||||||
@ -65,7 +65,7 @@ urlpatterns = [
|
|||||||
name="comment-reactions-project-board",
|
name="comment-reactions-project-board",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/project-boards/<uuid:project_id>/comments/<uuid:comment_id>/reactions/<str:reaction_code>/",
|
"anchor/<uuid:anchor_id>/comments/<uuid:comment_id>/reactions/<str:reaction_code>/",
|
||||||
CommentReactionPublicViewSet.as_view(
|
CommentReactionPublicViewSet.as_view(
|
||||||
{
|
{
|
||||||
"delete": "destroy",
|
"delete": "destroy",
|
||||||
|
@ -4,17 +4,23 @@ from django.urls import path
|
|||||||
from plane.space.views import (
|
from plane.space.views import (
|
||||||
ProjectDeployBoardPublicSettingsEndpoint,
|
ProjectDeployBoardPublicSettingsEndpoint,
|
||||||
ProjectIssuesPublicEndpoint,
|
ProjectIssuesPublicEndpoint,
|
||||||
|
WorkspaceProjectAnchorEndpoint,
|
||||||
)
|
)
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/project-boards/<uuid:project_id>/settings/",
|
"anchor/<uuid:anchor_id>/settings/",
|
||||||
ProjectDeployBoardPublicSettingsEndpoint.as_view(),
|
ProjectDeployBoardPublicSettingsEndpoint.as_view(),
|
||||||
name="project-deploy-board-settings",
|
name="project-deploy-board-settings",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/project-boards/<uuid:project_id>/issues/",
|
"anchor/<uuid:anchor_id>/issues/",
|
||||||
ProjectIssuesPublicEndpoint.as_view(),
|
ProjectIssuesPublicEndpoint.as_view(),
|
||||||
name="project-deploy-board",
|
name="project-deploy-board",
|
||||||
),
|
),
|
||||||
|
path(
|
||||||
|
"workspaces/<str:slug>/projects/<uuid:project_id>/anchor/",
|
||||||
|
WorkspaceProjectAnchorEndpoint.as_view(),
|
||||||
|
name="project-deploy-board",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from .project import (
|
from .project import (
|
||||||
ProjectDeployBoardPublicSettingsEndpoint,
|
ProjectDeployBoardPublicSettingsEndpoint,
|
||||||
WorkspaceProjectDeployBoardEndpoint,
|
WorkspaceProjectDeployBoardEndpoint,
|
||||||
|
WorkspaceProjectAnchorEndpoint,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .issue import (
|
from .issue import (
|
||||||
|
@ -58,9 +58,9 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
)
|
)
|
||||||
return InboxIssue.objects.none()
|
return InboxIssue.objects.none()
|
||||||
|
|
||||||
def list(self, request, slug, project_id, inbox_id):
|
def list(self, request, anchor, inbox_id):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
if project_deploy_board.inbox is None:
|
if project_deploy_board.inbox is None:
|
||||||
return Response(
|
return Response(
|
||||||
@ -72,8 +72,8 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
issues = (
|
issues = (
|
||||||
Issue.objects.filter(
|
Issue.objects.filter(
|
||||||
issue_inbox__inbox_id=inbox_id,
|
issue_inbox__inbox_id=inbox_id,
|
||||||
workspace__slug=slug,
|
workspace_id=project_deploy_board.workspace_id,
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
)
|
)
|
||||||
.filter(**filters)
|
.filter(**filters)
|
||||||
.annotate(bridge_id=F("issue_inbox__id"))
|
.annotate(bridge_id=F("issue_inbox__id"))
|
||||||
@ -117,9 +117,9 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
status=status.HTTP_200_OK,
|
status=status.HTTP_200_OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
def create(self, request, slug, project_id, inbox_id):
|
def create(self, request, anchor, inbox_id):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
if project_deploy_board.inbox is None:
|
if project_deploy_board.inbox is None:
|
||||||
return Response(
|
return Response(
|
||||||
@ -151,7 +151,7 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
name="Triage",
|
name="Triage",
|
||||||
group="backlog",
|
group="backlog",
|
||||||
description="Default state for managing all Inbox Issues",
|
description="Default state for managing all Inbox Issues",
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
color="#ff7700",
|
color="#ff7700",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
"description_html", "<p></p>"
|
"description_html", "<p></p>"
|
||||||
),
|
),
|
||||||
priority=request.data.get("issue", {}).get("priority", "low"),
|
priority=request.data.get("issue", {}).get("priority", "low"),
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
state=state,
|
state=state,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -173,14 +173,14 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
requested_data=json.dumps(request.data, cls=DjangoJSONEncoder),
|
requested_data=json.dumps(request.data, cls=DjangoJSONEncoder),
|
||||||
actor_id=str(request.user.id),
|
actor_id=str(request.user.id),
|
||||||
issue_id=str(issue.id),
|
issue_id=str(issue.id),
|
||||||
project_id=str(project_id),
|
project_id=str(project_deploy_board.project_id),
|
||||||
current_instance=None,
|
current_instance=None,
|
||||||
epoch=int(timezone.now().timestamp()),
|
epoch=int(timezone.now().timestamp()),
|
||||||
)
|
)
|
||||||
# create an inbox issue
|
# create an inbox issue
|
||||||
InboxIssue.objects.create(
|
InboxIssue.objects.create(
|
||||||
inbox_id=inbox_id,
|
inbox_id=inbox_id,
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
issue=issue,
|
issue=issue,
|
||||||
source=request.data.get("source", "in-app"),
|
source=request.data.get("source", "in-app"),
|
||||||
)
|
)
|
||||||
@ -188,9 +188,9 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
serializer = IssueStateInboxSerializer(issue)
|
serializer = IssueStateInboxSerializer(issue)
|
||||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
def partial_update(self, request, slug, project_id, inbox_id, pk):
|
def partial_update(self, request, anchor, inbox_id, pk):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
if project_deploy_board.inbox is None:
|
if project_deploy_board.inbox is None:
|
||||||
return Response(
|
return Response(
|
||||||
@ -200,8 +200,8 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
|
|
||||||
inbox_issue = InboxIssue.objects.get(
|
inbox_issue = InboxIssue.objects.get(
|
||||||
pk=pk,
|
pk=pk,
|
||||||
workspace__slug=slug,
|
workspace_id=project_deploy_board.workspace_id,
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
inbox_id=inbox_id,
|
inbox_id=inbox_id,
|
||||||
)
|
)
|
||||||
# Get the project member
|
# Get the project member
|
||||||
@ -216,8 +216,8 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
|
|
||||||
issue = Issue.objects.get(
|
issue = Issue.objects.get(
|
||||||
pk=inbox_issue.issue_id,
|
pk=inbox_issue.issue_id,
|
||||||
workspace__slug=slug,
|
workspace_id=project_deploy_board.workspace_id,
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
)
|
)
|
||||||
# viewers and guests since only viewers and guests
|
# viewers and guests since only viewers and guests
|
||||||
issue_data = {
|
issue_data = {
|
||||||
@ -242,7 +242,7 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
requested_data=requested_data,
|
requested_data=requested_data,
|
||||||
actor_id=str(request.user.id),
|
actor_id=str(request.user.id),
|
||||||
issue_id=str(issue.id),
|
issue_id=str(issue.id),
|
||||||
project_id=str(project_id),
|
project_id=str(project_deploy_board.project_id),
|
||||||
current_instance=json.dumps(
|
current_instance=json.dumps(
|
||||||
IssueSerializer(current_instance).data,
|
IssueSerializer(current_instance).data,
|
||||||
cls=DjangoJSONEncoder,
|
cls=DjangoJSONEncoder,
|
||||||
@ -255,9 +255,9 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
issue_serializer.errors, status=status.HTTP_400_BAD_REQUEST
|
issue_serializer.errors, status=status.HTTP_400_BAD_REQUEST
|
||||||
)
|
)
|
||||||
|
|
||||||
def retrieve(self, request, slug, project_id, inbox_id, pk):
|
def retrieve(self, request, anchor, inbox_id, pk):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
if project_deploy_board.inbox is None:
|
if project_deploy_board.inbox is None:
|
||||||
return Response(
|
return Response(
|
||||||
@ -267,21 +267,21 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
|
|
||||||
inbox_issue = InboxIssue.objects.get(
|
inbox_issue = InboxIssue.objects.get(
|
||||||
pk=pk,
|
pk=pk,
|
||||||
workspace__slug=slug,
|
workspace_id=project_deploy_board.workspace_id,
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
inbox_id=inbox_id,
|
inbox_id=inbox_id,
|
||||||
)
|
)
|
||||||
issue = Issue.objects.get(
|
issue = Issue.objects.get(
|
||||||
pk=inbox_issue.issue_id,
|
pk=inbox_issue.issue_id,
|
||||||
workspace__slug=slug,
|
workspace_id=project_deploy_board.workspace_id,
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
)
|
)
|
||||||
serializer = IssueStateInboxSerializer(issue)
|
serializer = IssueStateInboxSerializer(issue)
|
||||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
def destroy(self, request, slug, project_id, inbox_id, pk):
|
def destroy(self, request, anchor, inbox_id, pk):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
if project_deploy_board.inbox is None:
|
if project_deploy_board.inbox is None:
|
||||||
return Response(
|
return Response(
|
||||||
@ -291,8 +291,8 @@ class InboxIssuePublicViewSet(BaseViewSet):
|
|||||||
|
|
||||||
inbox_issue = InboxIssue.objects.get(
|
inbox_issue = InboxIssue.objects.get(
|
||||||
pk=pk,
|
pk=pk,
|
||||||
workspace__slug=slug,
|
workspace_id=project_deploy_board.workspace_id,
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
inbox_id=inbox_id,
|
inbox_id=inbox_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -106,9 +106,9 @@ class IssueCommentPublicViewSet(BaseViewSet):
|
|||||||
except DeployBoard.DoesNotExist:
|
except DeployBoard.DoesNotExist:
|
||||||
return IssueComment.objects.none()
|
return IssueComment.objects.none()
|
||||||
|
|
||||||
def create(self, request, slug, project_id, issue_id):
|
def create(self, request, anchor, issue_id):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not project_deploy_board.comments:
|
if not project_deploy_board.comments:
|
||||||
@ -120,7 +120,7 @@ class IssueCommentPublicViewSet(BaseViewSet):
|
|||||||
serializer = IssueCommentSerializer(data=request.data)
|
serializer = IssueCommentSerializer(data=request.data)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
serializer.save(
|
serializer.save(
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
issue_id=issue_id,
|
issue_id=issue_id,
|
||||||
actor=request.user,
|
actor=request.user,
|
||||||
access="EXTERNAL",
|
access="EXTERNAL",
|
||||||
@ -132,27 +132,27 @@ class IssueCommentPublicViewSet(BaseViewSet):
|
|||||||
),
|
),
|
||||||
actor_id=str(request.user.id),
|
actor_id=str(request.user.id),
|
||||||
issue_id=str(issue_id),
|
issue_id=str(issue_id),
|
||||||
project_id=str(project_id),
|
project_id=str(project_deploy_board.project_id),
|
||||||
current_instance=None,
|
current_instance=None,
|
||||||
epoch=int(timezone.now().timestamp()),
|
epoch=int(timezone.now().timestamp()),
|
||||||
)
|
)
|
||||||
if not ProjectMember.objects.filter(
|
if not ProjectMember.objects.filter(
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
member=request.user,
|
member=request.user,
|
||||||
is_active=True,
|
is_active=True,
|
||||||
).exists():
|
).exists():
|
||||||
# Add the user for workspace tracking
|
# Add the user for workspace tracking
|
||||||
_ = ProjectPublicMember.objects.get_or_create(
|
_ = ProjectPublicMember.objects.get_or_create(
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
member=request.user,
|
member=request.user,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
def partial_update(self, request, slug, project_id, issue_id, pk):
|
def partial_update(self, request, anchor, issue_id, pk):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not project_deploy_board.comments:
|
if not project_deploy_board.comments:
|
||||||
@ -160,9 +160,7 @@ class IssueCommentPublicViewSet(BaseViewSet):
|
|||||||
{"error": "Comments are not enabled for this project"},
|
{"error": "Comments are not enabled for this project"},
|
||||||
status=status.HTTP_400_BAD_REQUEST,
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
)
|
)
|
||||||
comment = IssueComment.objects.get(
|
comment = IssueComment.objects.get(pk=pk, actor=request.user)
|
||||||
workspace__slug=slug, pk=pk, actor=request.user
|
|
||||||
)
|
|
||||||
serializer = IssueCommentSerializer(
|
serializer = IssueCommentSerializer(
|
||||||
comment, data=request.data, partial=True
|
comment, data=request.data, partial=True
|
||||||
)
|
)
|
||||||
@ -173,7 +171,7 @@ class IssueCommentPublicViewSet(BaseViewSet):
|
|||||||
requested_data=json.dumps(request.data, cls=DjangoJSONEncoder),
|
requested_data=json.dumps(request.data, cls=DjangoJSONEncoder),
|
||||||
actor_id=str(request.user.id),
|
actor_id=str(request.user.id),
|
||||||
issue_id=str(issue_id),
|
issue_id=str(issue_id),
|
||||||
project_id=str(project_id),
|
project_id=str(project_deploy_board.project_id),
|
||||||
current_instance=json.dumps(
|
current_instance=json.dumps(
|
||||||
IssueCommentSerializer(comment).data,
|
IssueCommentSerializer(comment).data,
|
||||||
cls=DjangoJSONEncoder,
|
cls=DjangoJSONEncoder,
|
||||||
@ -183,9 +181,9 @@ class IssueCommentPublicViewSet(BaseViewSet):
|
|||||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
def destroy(self, request, slug, project_id, issue_id, pk):
|
def destroy(self, request, anchor, issue_id, pk):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not project_deploy_board.comments:
|
if not project_deploy_board.comments:
|
||||||
@ -194,9 +192,7 @@ class IssueCommentPublicViewSet(BaseViewSet):
|
|||||||
status=status.HTTP_400_BAD_REQUEST,
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
)
|
)
|
||||||
comment = IssueComment.objects.get(
|
comment = IssueComment.objects.get(
|
||||||
workspace__slug=slug,
|
|
||||||
pk=pk,
|
pk=pk,
|
||||||
project_id=project_id,
|
|
||||||
actor=request.user,
|
actor=request.user,
|
||||||
)
|
)
|
||||||
issue_activity.delay(
|
issue_activity.delay(
|
||||||
@ -204,7 +200,7 @@ class IssueCommentPublicViewSet(BaseViewSet):
|
|||||||
requested_data=json.dumps({"comment_id": str(pk)}),
|
requested_data=json.dumps({"comment_id": str(pk)}),
|
||||||
actor_id=str(request.user.id),
|
actor_id=str(request.user.id),
|
||||||
issue_id=str(issue_id),
|
issue_id=str(issue_id),
|
||||||
project_id=str(project_id),
|
project_id=str(project_deploy_board.project_id),
|
||||||
current_instance=json.dumps(
|
current_instance=json.dumps(
|
||||||
IssueCommentSerializer(comment).data,
|
IssueCommentSerializer(comment).data,
|
||||||
cls=DjangoJSONEncoder,
|
cls=DjangoJSONEncoder,
|
||||||
@ -239,9 +235,9 @@ class IssueReactionPublicViewSet(BaseViewSet):
|
|||||||
except DeployBoard.DoesNotExist:
|
except DeployBoard.DoesNotExist:
|
||||||
return IssueReaction.objects.none()
|
return IssueReaction.objects.none()
|
||||||
|
|
||||||
def create(self, request, slug, project_id, issue_id):
|
def create(self, request, anchor, issue_id):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not project_deploy_board.reactions:
|
if not project_deploy_board.reactions:
|
||||||
@ -253,16 +249,18 @@ class IssueReactionPublicViewSet(BaseViewSet):
|
|||||||
serializer = IssueReactionSerializer(data=request.data)
|
serializer = IssueReactionSerializer(data=request.data)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
serializer.save(
|
serializer.save(
|
||||||
project_id=project_id, issue_id=issue_id, actor=request.user
|
project_id=project_deploy_board.project_id,
|
||||||
|
issue_id=issue_id,
|
||||||
|
actor=request.user,
|
||||||
)
|
)
|
||||||
if not ProjectMember.objects.filter(
|
if not ProjectMember.objects.filter(
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
member=request.user,
|
member=request.user,
|
||||||
is_active=True,
|
is_active=True,
|
||||||
).exists():
|
).exists():
|
||||||
# Add the user for workspace tracking
|
# Add the user for workspace tracking
|
||||||
_ = ProjectPublicMember.objects.get_or_create(
|
_ = ProjectPublicMember.objects.get_or_create(
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
member=request.user,
|
member=request.user,
|
||||||
)
|
)
|
||||||
issue_activity.delay(
|
issue_activity.delay(
|
||||||
@ -272,16 +270,16 @@ class IssueReactionPublicViewSet(BaseViewSet):
|
|||||||
),
|
),
|
||||||
actor_id=str(self.request.user.id),
|
actor_id=str(self.request.user.id),
|
||||||
issue_id=str(self.kwargs.get("issue_id", None)),
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
||||||
project_id=str(self.kwargs.get("project_id", None)),
|
project_id=str(project_deploy_board.project_id),
|
||||||
current_instance=None,
|
current_instance=None,
|
||||||
epoch=int(timezone.now().timestamp()),
|
epoch=int(timezone.now().timestamp()),
|
||||||
)
|
)
|
||||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
def destroy(self, request, slug, project_id, issue_id, reaction_code):
|
def destroy(self, request, anchor, issue_id, reaction_code):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not project_deploy_board.reactions:
|
if not project_deploy_board.reactions:
|
||||||
@ -290,7 +288,7 @@ class IssueReactionPublicViewSet(BaseViewSet):
|
|||||||
status=status.HTTP_400_BAD_REQUEST,
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
)
|
)
|
||||||
issue_reaction = IssueReaction.objects.get(
|
issue_reaction = IssueReaction.objects.get(
|
||||||
workspace__slug=slug,
|
workspace_id=project_deploy_board.workspace_id,
|
||||||
issue_id=issue_id,
|
issue_id=issue_id,
|
||||||
reaction=reaction_code,
|
reaction=reaction_code,
|
||||||
actor=request.user,
|
actor=request.user,
|
||||||
@ -300,7 +298,7 @@ class IssueReactionPublicViewSet(BaseViewSet):
|
|||||||
requested_data=None,
|
requested_data=None,
|
||||||
actor_id=str(self.request.user.id),
|
actor_id=str(self.request.user.id),
|
||||||
issue_id=str(self.kwargs.get("issue_id", None)),
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
||||||
project_id=str(self.kwargs.get("project_id", None)),
|
project_id=str(project_deploy_board.project_id),
|
||||||
current_instance=json.dumps(
|
current_instance=json.dumps(
|
||||||
{
|
{
|
||||||
"reaction": str(reaction_code),
|
"reaction": str(reaction_code),
|
||||||
@ -320,15 +318,14 @@ class CommentReactionPublicViewSet(BaseViewSet):
|
|||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
try:
|
try:
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=self.kwargs.get("slug"),
|
anchor=self.kwargs.get("anchor"), entity_name="project"
|
||||||
project_id=self.kwargs.get("project_id"),
|
|
||||||
)
|
)
|
||||||
if project_deploy_board.reactions:
|
if project_deploy_board.reactions:
|
||||||
return (
|
return (
|
||||||
super()
|
super()
|
||||||
.get_queryset()
|
.get_queryset()
|
||||||
.filter(workspace__slug=self.kwargs.get("slug"))
|
.filter(workspace_id=project_deploy_board.workspace_id)
|
||||||
.filter(project_id=self.kwargs.get("project_id"))
|
.filter(project_id=project_deploy_board.project_id)
|
||||||
.filter(comment_id=self.kwargs.get("comment_id"))
|
.filter(comment_id=self.kwargs.get("comment_id"))
|
||||||
.order_by("-created_at")
|
.order_by("-created_at")
|
||||||
.distinct()
|
.distinct()
|
||||||
@ -337,9 +334,9 @@ class CommentReactionPublicViewSet(BaseViewSet):
|
|||||||
except DeployBoard.DoesNotExist:
|
except DeployBoard.DoesNotExist:
|
||||||
return CommentReaction.objects.none()
|
return CommentReaction.objects.none()
|
||||||
|
|
||||||
def create(self, request, slug, project_id, comment_id):
|
def create(self, request, anchor, comment_id):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not project_deploy_board.reactions:
|
if not project_deploy_board.reactions:
|
||||||
@ -351,18 +348,18 @@ class CommentReactionPublicViewSet(BaseViewSet):
|
|||||||
serializer = CommentReactionSerializer(data=request.data)
|
serializer = CommentReactionSerializer(data=request.data)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
serializer.save(
|
serializer.save(
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
comment_id=comment_id,
|
comment_id=comment_id,
|
||||||
actor=request.user,
|
actor=request.user,
|
||||||
)
|
)
|
||||||
if not ProjectMember.objects.filter(
|
if not ProjectMember.objects.filter(
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
member=request.user,
|
member=request.user,
|
||||||
is_active=True,
|
is_active=True,
|
||||||
).exists():
|
).exists():
|
||||||
# Add the user for workspace tracking
|
# Add the user for workspace tracking
|
||||||
_ = ProjectPublicMember.objects.get_or_create(
|
_ = ProjectPublicMember.objects.get_or_create(
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
member=request.user,
|
member=request.user,
|
||||||
)
|
)
|
||||||
issue_activity.delay(
|
issue_activity.delay(
|
||||||
@ -379,9 +376,9 @@ class CommentReactionPublicViewSet(BaseViewSet):
|
|||||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
def destroy(self, request, slug, project_id, comment_id, reaction_code):
|
def destroy(self, request, anchor, comment_id, reaction_code):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
if not project_deploy_board.reactions:
|
if not project_deploy_board.reactions:
|
||||||
return Response(
|
return Response(
|
||||||
@ -390,8 +387,8 @@ class CommentReactionPublicViewSet(BaseViewSet):
|
|||||||
)
|
)
|
||||||
|
|
||||||
comment_reaction = CommentReaction.objects.get(
|
comment_reaction = CommentReaction.objects.get(
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
workspace__slug=slug,
|
workspace_id=project_deploy_board.workspace_id,
|
||||||
comment_id=comment_id,
|
comment_id=comment_id,
|
||||||
reaction=reaction_code,
|
reaction=reaction_code,
|
||||||
actor=request.user,
|
actor=request.user,
|
||||||
@ -401,7 +398,7 @@ class CommentReactionPublicViewSet(BaseViewSet):
|
|||||||
requested_data=None,
|
requested_data=None,
|
||||||
actor_id=str(self.request.user.id),
|
actor_id=str(self.request.user.id),
|
||||||
issue_id=None,
|
issue_id=None,
|
||||||
project_id=str(self.kwargs.get("project_id", None)),
|
project_id=str(project_deploy_board.project_id),
|
||||||
current_instance=json.dumps(
|
current_instance=json.dumps(
|
||||||
{
|
{
|
||||||
"reaction": str(reaction_code),
|
"reaction": str(reaction_code),
|
||||||
@ -422,35 +419,37 @@ class IssueVotePublicViewSet(BaseViewSet):
|
|||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
try:
|
try:
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=self.kwargs.get("slug"),
|
workspace__slug=self.kwargs.get("anchor"),
|
||||||
project_id=self.kwargs.get("project_id"),
|
entity_name="project",
|
||||||
)
|
)
|
||||||
if project_deploy_board.votes:
|
if project_deploy_board.votes:
|
||||||
return (
|
return (
|
||||||
super()
|
super()
|
||||||
.get_queryset()
|
.get_queryset()
|
||||||
.filter(issue_id=self.kwargs.get("issue_id"))
|
.filter(issue_id=self.kwargs.get("issue_id"))
|
||||||
.filter(workspace__slug=self.kwargs.get("slug"))
|
.filter(workspace_id=project_deploy_board.workspace_id)
|
||||||
.filter(project_id=self.kwargs.get("project_id"))
|
.filter(project_id=project_deploy_board.project_id)
|
||||||
)
|
)
|
||||||
return IssueVote.objects.none()
|
return IssueVote.objects.none()
|
||||||
except DeployBoard.DoesNotExist:
|
except DeployBoard.DoesNotExist:
|
||||||
return IssueVote.objects.none()
|
return IssueVote.objects.none()
|
||||||
|
|
||||||
def create(self, request, slug, project_id, issue_id):
|
def create(self, request, anchor, issue_id):
|
||||||
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
|
anchor=anchor, entity_name="project"
|
||||||
|
)
|
||||||
issue_vote, _ = IssueVote.objects.get_or_create(
|
issue_vote, _ = IssueVote.objects.get_or_create(
|
||||||
actor_id=request.user.id,
|
actor_id=request.user.id,
|
||||||
project_id=project_id,
|
|
||||||
issue_id=issue_id,
|
issue_id=issue_id,
|
||||||
)
|
)
|
||||||
# Add the user for workspace tracking
|
# Add the user for workspace tracking
|
||||||
if not ProjectMember.objects.filter(
|
if not ProjectMember.objects.filter(
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
member=request.user,
|
member=request.user,
|
||||||
is_active=True,
|
is_active=True,
|
||||||
).exists():
|
).exists():
|
||||||
_ = ProjectPublicMember.objects.get_or_create(
|
_ = ProjectPublicMember.objects.get_or_create(
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
member=request.user,
|
member=request.user,
|
||||||
)
|
)
|
||||||
issue_vote.vote = request.data.get("vote", 1)
|
issue_vote.vote = request.data.get("vote", 1)
|
||||||
@ -462,26 +461,29 @@ class IssueVotePublicViewSet(BaseViewSet):
|
|||||||
),
|
),
|
||||||
actor_id=str(self.request.user.id),
|
actor_id=str(self.request.user.id),
|
||||||
issue_id=str(self.kwargs.get("issue_id", None)),
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
||||||
project_id=str(self.kwargs.get("project_id", None)),
|
project_id=str(project_deploy_board.project_id),
|
||||||
current_instance=None,
|
current_instance=None,
|
||||||
epoch=int(timezone.now().timestamp()),
|
epoch=int(timezone.now().timestamp()),
|
||||||
)
|
)
|
||||||
serializer = IssueVoteSerializer(issue_vote)
|
serializer = IssueVoteSerializer(issue_vote)
|
||||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||||
|
|
||||||
def destroy(self, request, slug, project_id, issue_id):
|
def destroy(self, request, anchor, issue_id):
|
||||||
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
|
anchor=anchor, entity_name="project"
|
||||||
|
)
|
||||||
issue_vote = IssueVote.objects.get(
|
issue_vote = IssueVote.objects.get(
|
||||||
workspace__slug=slug,
|
|
||||||
project_id=project_id,
|
|
||||||
issue_id=issue_id,
|
issue_id=issue_id,
|
||||||
actor_id=request.user.id,
|
actor_id=request.user.id,
|
||||||
|
project_id=project_deploy_board.project_id,
|
||||||
|
workspace_id=project_deploy_board.workspace_id,
|
||||||
)
|
)
|
||||||
issue_activity.delay(
|
issue_activity.delay(
|
||||||
type="issue_vote.activity.deleted",
|
type="issue_vote.activity.deleted",
|
||||||
requested_data=None,
|
requested_data=None,
|
||||||
actor_id=str(self.request.user.id),
|
actor_id=str(self.request.user.id),
|
||||||
issue_id=str(self.kwargs.get("issue_id", None)),
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
||||||
project_id=str(self.kwargs.get("project_id", None)),
|
project_id=str(project_deploy_board.project_id),
|
||||||
current_instance=json.dumps(
|
current_instance=json.dumps(
|
||||||
{
|
{
|
||||||
"vote": str(issue_vote.vote),
|
"vote": str(issue_vote.vote),
|
||||||
@ -499,9 +501,14 @@ class IssueRetrievePublicEndpoint(BaseAPIView):
|
|||||||
AllowAny,
|
AllowAny,
|
||||||
]
|
]
|
||||||
|
|
||||||
def get(self, request, slug, project_id, issue_id):
|
def get(self, request, anchor, issue_id):
|
||||||
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
|
anchor=anchor, entity_name="project"
|
||||||
|
)
|
||||||
issue = Issue.objects.get(
|
issue = Issue.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id, pk=issue_id
|
workspace_id=project_deploy_board.workspace_id,
|
||||||
|
project_id=project_deploy_board.project_id,
|
||||||
|
pk=issue_id,
|
||||||
)
|
)
|
||||||
serializer = IssuePublicSerializer(issue)
|
serializer = IssuePublicSerializer(issue)
|
||||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
@ -512,14 +519,17 @@ class ProjectIssuesPublicEndpoint(BaseAPIView):
|
|||||||
AllowAny,
|
AllowAny,
|
||||||
]
|
]
|
||||||
|
|
||||||
def get(self, request, slug, project_id):
|
def get(self, request, anchor):
|
||||||
if not DeployBoard.objects.filter(
|
if not DeployBoard.objects.filter(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
).exists():
|
).exists():
|
||||||
return Response(
|
return Response(
|
||||||
{"error": "Project is not published"},
|
{"error": "Project is not published"},
|
||||||
status=status.HTTP_404_NOT_FOUND,
|
status=status.HTTP_404_NOT_FOUND,
|
||||||
)
|
)
|
||||||
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
|
anchor=anchor, entity_name="project"
|
||||||
|
)
|
||||||
|
|
||||||
filters = issue_filters(request.query_params, "GET")
|
filters = issue_filters(request.query_params, "GET")
|
||||||
|
|
||||||
@ -544,8 +554,8 @@ class ProjectIssuesPublicEndpoint(BaseAPIView):
|
|||||||
.annotate(count=Func(F("id"), function="Count"))
|
.annotate(count=Func(F("id"), function="Count"))
|
||||||
.values("count")
|
.values("count")
|
||||||
)
|
)
|
||||||
.filter(project_id=project_id)
|
.filter(project_id=project_deploy_board.project_id)
|
||||||
.filter(workspace__slug=slug)
|
.filter(workspace_id=project_deploy_board.workspace_id)
|
||||||
.select_related("project", "workspace", "state", "parent")
|
.select_related("project", "workspace", "state", "parent")
|
||||||
.prefetch_related("assignees", "labels")
|
.prefetch_related("assignees", "labels")
|
||||||
.prefetch_related(
|
.prefetch_related(
|
||||||
@ -652,8 +662,8 @@ class ProjectIssuesPublicEndpoint(BaseAPIView):
|
|||||||
states = (
|
states = (
|
||||||
State.objects.filter(
|
State.objects.filter(
|
||||||
~Q(name="Triage"),
|
~Q(name="Triage"),
|
||||||
workspace__slug=slug,
|
workspace_id=project_deploy_board.workspace_id,
|
||||||
project_id=project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
custom_order=Case(
|
custom_order=Case(
|
||||||
@ -670,7 +680,8 @@ class ProjectIssuesPublicEndpoint(BaseAPIView):
|
|||||||
)
|
)
|
||||||
|
|
||||||
labels = Label.objects.filter(
|
labels = Label.objects.filter(
|
||||||
workspace__slug=slug, project_id=project_id
|
workspace_id=project_deploy_board.workspace_id,
|
||||||
|
project_id=project_deploy_board.project_id,
|
||||||
).values("id", "name", "color", "parent")
|
).values("id", "name", "color", "parent")
|
||||||
|
|
||||||
## Grouping the results
|
## Grouping the results
|
||||||
|
@ -23,9 +23,9 @@ class ProjectDeployBoardPublicSettingsEndpoint(BaseAPIView):
|
|||||||
AllowAny,
|
AllowAny,
|
||||||
]
|
]
|
||||||
|
|
||||||
def get(self, request, slug, project_id):
|
def get(self, request, anchor):
|
||||||
project_deploy_board = DeployBoard.objects.get(
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id
|
anchor=anchor, entity_name="project"
|
||||||
)
|
)
|
||||||
serializer = DeployBoardSerializer(project_deploy_board)
|
serializer = DeployBoardSerializer(project_deploy_board)
|
||||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
@ -36,13 +36,16 @@ class WorkspaceProjectDeployBoardEndpoint(BaseAPIView):
|
|||||||
AllowAny,
|
AllowAny,
|
||||||
]
|
]
|
||||||
|
|
||||||
def get(self, request, slug):
|
def get(self, request, anchor):
|
||||||
|
deploy_board = DeployBoard.objects.filter(anchor=anchor, entity_name="project").values_list
|
||||||
projects = (
|
projects = (
|
||||||
Project.objects.filter(workspace__slug=slug)
|
Project.objects.filter(workspace=deploy_board.workspace)
|
||||||
.annotate(
|
.annotate(
|
||||||
is_public=Exists(
|
is_public=Exists(
|
||||||
DeployBoard.objects.filter(
|
DeployBoard.objects.filter(
|
||||||
workspace__slug=slug, project_id=OuterRef("pk")
|
anchor=anchor,
|
||||||
|
project_id=OuterRef("pk"),
|
||||||
|
entity_name="project",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -58,3 +61,17 @@ class WorkspaceProjectDeployBoardEndpoint(BaseAPIView):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return Response(projects, status=status.HTTP_200_OK)
|
return Response(projects, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|
||||||
|
class WorkspaceProjectAnchorEndpoint(BaseAPIView):
|
||||||
|
permission_classes = [
|
||||||
|
AllowAny,
|
||||||
|
]
|
||||||
|
|
||||||
|
def get(self, request, slug, project_id):
|
||||||
|
print("did it come here")
|
||||||
|
project_deploy_board = DeployBoard.objects.get(
|
||||||
|
workspace__slug=slug, project_id=project_id
|
||||||
|
)
|
||||||
|
serializer = DeployBoardSerializer(project_deploy_board)
|
||||||
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
|
Loading…
Reference in New Issue
Block a user