mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
Merge branch 'stage-release' of https://github.com/makeplane/plane into feat/issue_view
This commit is contained in:
commit
7a771a38ac
@ -37,6 +37,7 @@ class IssueFlatSerializer(BaseSerializer):
|
|||||||
"priority",
|
"priority",
|
||||||
"start_date",
|
"start_date",
|
||||||
"target_date",
|
"target_date",
|
||||||
|
"sequence_id",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,7 +52,6 @@ from plane.api.views import (
|
|||||||
AddMemberToProjectEndpoint,
|
AddMemberToProjectEndpoint,
|
||||||
ProjectJoinEndpoint,
|
ProjectJoinEndpoint,
|
||||||
BulkDeleteIssuesEndpoint,
|
BulkDeleteIssuesEndpoint,
|
||||||
BulkAssignIssuesToCycleEndpoint,
|
|
||||||
ProjectUserViewsEndpoint,
|
ProjectUserViewsEndpoint,
|
||||||
ModuleViewSet,
|
ModuleViewSet,
|
||||||
ModuleIssueViewSet,
|
ModuleIssueViewSet,
|
||||||
@ -444,11 +443,6 @@ urlpatterns = [
|
|||||||
),
|
),
|
||||||
name="project-cycle",
|
name="project-cycle",
|
||||||
),
|
),
|
||||||
path(
|
|
||||||
"workspaces/<str:slug>/projects/<uuid:project_id>/cycles/<uuid:cycle_id>/bulk-assign-issues/",
|
|
||||||
BulkAssignIssuesToCycleEndpoint.as_view(),
|
|
||||||
name="bulk-assign-cycle-issues",
|
|
||||||
),
|
|
||||||
## End Cycles
|
## End Cycles
|
||||||
# Issue
|
# Issue
|
||||||
path(
|
path(
|
||||||
|
@ -38,7 +38,7 @@ from .workspace import (
|
|||||||
from .state import StateViewSet
|
from .state import StateViewSet
|
||||||
from .shortcut import ShortCutViewSet
|
from .shortcut import ShortCutViewSet
|
||||||
from .view import ViewViewSet
|
from .view import ViewViewSet
|
||||||
from .cycle import CycleViewSet, CycleIssueViewSet, BulkAssignIssuesToCycleEndpoint
|
from .cycle import CycleViewSet, CycleIssueViewSet
|
||||||
from .asset import FileAssetEndpoint
|
from .asset import FileAssetEndpoint
|
||||||
from .issue import (
|
from .issue import (
|
||||||
IssueViewSet,
|
IssueViewSet,
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
# Third party imports
|
# Third party imports
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
|
from sentry_sdk import capture_exception
|
||||||
|
|
||||||
# Module imports
|
# Module imports
|
||||||
from . import BaseViewSet, BaseAPIView
|
from . import BaseViewSet
|
||||||
from plane.api.serializers import CycleSerializer, CycleIssueSerializer
|
from plane.api.serializers import CycleSerializer, CycleIssueSerializer
|
||||||
from plane.api.permissions import ProjectEntityPermission
|
from plane.api.permissions import ProjectEntityPermission
|
||||||
from plane.db.models import Cycle, CycleIssue, Issue
|
from plane.db.models import Cycle, CycleIssue, Issue
|
||||||
@ -66,26 +67,27 @@ class CycleIssueViewSet(BaseViewSet):
|
|||||||
.distinct()
|
.distinct()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def create(self, request, slug, project_id, cycle_id):
|
||||||
class BulkAssignIssuesToCycleEndpoint(BaseAPIView):
|
|
||||||
|
|
||||||
permission_classes = [
|
|
||||||
ProjectEntityPermission,
|
|
||||||
]
|
|
||||||
|
|
||||||
def post(self, request, slug, project_id, cycle_id):
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
issue_ids = request.data.get("issue_ids")
|
issues = request.data.get("issue", [])
|
||||||
|
|
||||||
|
if not len(issues):
|
||||||
|
return Response(
|
||||||
|
{"error": "Issues are required"}, status=status.HTTP_400_BAD_REQUEST
|
||||||
|
)
|
||||||
|
|
||||||
cycle = Cycle.objects.get(
|
cycle = Cycle.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id, pk=cycle_id
|
workspace__slug=slug, project_id=project_id, pk=cycle_id
|
||||||
)
|
)
|
||||||
|
|
||||||
issues = Issue.objects.filter(
|
issues = Issue.objects.filter(
|
||||||
pk__in=issue_ids, workspace__slug=slug, project_id=project_id
|
pk__in=issues, workspace__slug=slug, project_id=project_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Delete old records in order to maintain the database integrity
|
||||||
|
CycleIssue.objects.filter(issue_id__in=issues).delete()
|
||||||
|
|
||||||
CycleIssue.objects.bulk_create(
|
CycleIssue.objects.bulk_create(
|
||||||
[
|
[
|
||||||
CycleIssue(
|
CycleIssue(
|
||||||
@ -107,3 +109,9 @@ class BulkAssignIssuesToCycleEndpoint(BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{"error": "Cycle not found"}, status=status.HTTP_404_NOT_FOUND
|
{"error": "Cycle not found"}, status=status.HTTP_404_NOT_FOUND
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
capture_exception(e)
|
||||||
|
return Response(
|
||||||
|
{"error": "Something went wrong please try again later"},
|
||||||
|
status=status.HTTP_200_OK,
|
||||||
|
)
|
||||||
|
@ -5,6 +5,7 @@ from django.db.models import Prefetch
|
|||||||
# Third party imports
|
# Third party imports
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
|
from sentry_sdk import capture_exception
|
||||||
|
|
||||||
# Module imports
|
# Module imports
|
||||||
from . import BaseViewSet
|
from . import BaseViewSet
|
||||||
@ -71,6 +72,13 @@ class ModuleViewSet(BaseViewSet):
|
|||||||
{"name": "The module name is already taken"},
|
{"name": "The module name is already taken"},
|
||||||
status=status.HTTP_410_GONE,
|
status=status.HTTP_410_GONE,
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
capture_exception(e)
|
||||||
|
return Response(
|
||||||
|
{"error": "Something went wrong please try again later"},
|
||||||
|
status=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ModuleIssueViewSet(BaseViewSet):
|
class ModuleIssueViewSet(BaseViewSet):
|
||||||
@ -107,3 +115,40 @@ class ModuleIssueViewSet(BaseViewSet):
|
|||||||
.select_related("issue")
|
.select_related("issue")
|
||||||
.distinct()
|
.distinct()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def create(self, request, slug, project_id, module_id):
|
||||||
|
try:
|
||||||
|
issues = request.data.get("issues", [])
|
||||||
|
if not len(issues):
|
||||||
|
return Response(
|
||||||
|
{"error": "Issues are required"}, status=status.HTTP_400_BAD_REQUEST
|
||||||
|
)
|
||||||
|
module = Module.objects.get(
|
||||||
|
workspace__slug=slug, project_id=project_id, pk=module_id
|
||||||
|
)
|
||||||
|
ModuleIssue.objects.bulk_create(
|
||||||
|
[
|
||||||
|
ModuleIssue(
|
||||||
|
module=module,
|
||||||
|
issue_id=issue,
|
||||||
|
project_id=project_id,
|
||||||
|
workspace=module.workspace,
|
||||||
|
created_by=request.user,
|
||||||
|
updated_by=request.user,
|
||||||
|
)
|
||||||
|
for issue in issues
|
||||||
|
],
|
||||||
|
batch_size=10,
|
||||||
|
ignore_conflicts=True,
|
||||||
|
)
|
||||||
|
return Response({"message": "Success"}, status=status.HTTP_200_OK)
|
||||||
|
except Module.DoesNotExist:
|
||||||
|
return Response(
|
||||||
|
{"error": "Module Does not exists"}, status=status.HTTP_400_BAD_REQUEST
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
capture_exception(e)
|
||||||
|
return Response(
|
||||||
|
{"error": "Something went wrong please try again later"},
|
||||||
|
status=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||||
|
)
|
||||||
|
@ -52,7 +52,6 @@ class PeopleEndpoint(BaseAPIView):
|
|||||||
class UserEndpoint(BaseViewSet):
|
class UserEndpoint(BaseViewSet):
|
||||||
serializer_class = UserSerializer
|
serializer_class = UserSerializer
|
||||||
model = User
|
model = User
|
||||||
serializers = {}
|
|
||||||
|
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
return self.request.user
|
return self.request.user
|
||||||
|
@ -632,7 +632,7 @@ class ProjectMemberUserEndpoint(BaseAPIView):
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
project_member = ProjectMember.objects.get(
|
project_member = ProjectMember.objects.get(
|
||||||
project=project_id, workpsace__slug=slug, member=request.user
|
project_id=project_id, workspace__slug=slug, member=request.user
|
||||||
)
|
)
|
||||||
serializer = ProjectMemberSerializer(project_member)
|
serializer = ProjectMemberSerializer(project_member)
|
||||||
|
|
||||||
|
18
apiserver/plane/db/migrations/0012_user_my_issues_prop.py
Normal file
18
apiserver/plane/db/migrations/0012_user_my_issues_prop.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.2.14 on 2022-12-20 09:48
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('db', '0011_auto_20221216_0259'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='user',
|
||||||
|
name='my_issues_prop',
|
||||||
|
field=models.JSONField(null=True),
|
||||||
|
),
|
||||||
|
]
|
@ -66,6 +66,7 @@ class User(AbstractBaseUser, PermissionsMixin):
|
|||||||
last_login_uagent = models.TextField(blank=True)
|
last_login_uagent = models.TextField(blank=True)
|
||||||
token_updated_at = models.DateTimeField(null=True)
|
token_updated_at = models.DateTimeField(null=True)
|
||||||
last_workspace_id = models.UUIDField(null=True)
|
last_workspace_id = models.UUIDField(null=True)
|
||||||
|
my_issues_prop = models.JSONField(null=True)
|
||||||
|
|
||||||
USERNAME_FIELD = "email"
|
USERNAME_FIELD = "email"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user