From b22e0625768f0b096b5898936ace76d6882b0736 Mon Sep 17 00:00:00 2001 From: NarayanBavisetti Date: Thu, 22 Jun 2023 18:20:59 +0530 Subject: [PATCH] feat: added CRUD operation for issue subscriber --- apiserver/plane/api/serializers/issue.py | 10 +++++----- apiserver/plane/api/urls.py | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/apiserver/plane/api/serializers/issue.py b/apiserver/plane/api/serializers/issue.py index 540ea9097..7376cf0ff 100644 --- a/apiserver/plane/api/serializers/issue.py +++ b/apiserver/plane/api/serializers/issue.py @@ -534,11 +534,11 @@ class IssueLiteSerializer(BaseSerializer): class IssueSubscriberSerializer(BaseSerializer): - project = serializers.PrimaryKeyRelatedField(read_only=True) - workspace = serializers.PrimaryKeyRelatedField(read_only=True) - issue = serializers.PrimaryKeyRelatedField(read_only=True) - subscriber = serializers.PrimaryKeyRelatedField(read_only=True) - class Meta: model = IssueSubscriber fields = "__all__" + read_only_fields = [ + "workspace", + "project", + "issue", + ] diff --git a/apiserver/plane/api/urls.py b/apiserver/plane/api/urls.py index bf370063a..9edd92867 100644 --- a/apiserver/plane/api/urls.py +++ b/apiserver/plane/api/urls.py @@ -801,16 +801,34 @@ urlpatterns = [ ## End IssueComments # Issue Subscribers path( - "workspaces//projects//issues//subscribers/", + "workspaces//projects//issues//issue-subscribers/", IssueSubscriberViewSet.as_view( { "get": "list", "post": "create", + } + ), + name="project-issue-subscriber", + ), + path( + "workspaces//projects//issues//issue-subscribers/", + IssueSubscriberViewSet.as_view( + { "delete": "destroy" } ), name="project-issue-subscriber", ), + path( + "workspaces//projects//issues//subscribe/", + IssueSubscriberViewSet.as_view( + { + "get": "subscription_status", + "post": "subscribe", + } + ), + name="project-issue-subscriber", + ), ## End Issue Subscribers ## IssueProperty path(