dev: rename user display configuration model (#5119)
* dev: rename model * dev: add fields to project and issue types
This commit is contained in:
parent
65caaa14cd
commit
6ade86f89d
13 changed files with 78 additions and 32 deletions
|
|
@ -19,7 +19,7 @@ from plane.app.permissions import ProjectBasePermission
|
||||||
from plane.db.models import (
|
from plane.db.models import (
|
||||||
Cycle,
|
Cycle,
|
||||||
Inbox,
|
Inbox,
|
||||||
IssueProperty,
|
IssueUserProperty,
|
||||||
Module,
|
Module,
|
||||||
Project,
|
Project,
|
||||||
DeployBoard,
|
DeployBoard,
|
||||||
|
|
@ -165,7 +165,7 @@ class ProjectAPIEndpoint(BaseAPIView):
|
||||||
role=20,
|
role=20,
|
||||||
)
|
)
|
||||||
# Also create the issue property for the user
|
# Also create the issue property for the user
|
||||||
_ = IssueProperty.objects.create(
|
_ = IssueUserProperty.objects.create(
|
||||||
project_id=serializer.data["id"],
|
project_id=serializer.data["id"],
|
||||||
user=request.user,
|
user=request.user,
|
||||||
)
|
)
|
||||||
|
|
@ -179,7 +179,7 @@ class ProjectAPIEndpoint(BaseAPIView):
|
||||||
role=20,
|
role=20,
|
||||||
)
|
)
|
||||||
# Also create the issue property for the user
|
# Also create the issue property for the user
|
||||||
IssueProperty.objects.create(
|
IssueUserProperty.objects.create(
|
||||||
project_id=serializer.data["id"],
|
project_id=serializer.data["id"],
|
||||||
user_id=serializer.data["project_lead"],
|
user_id=serializer.data["project_lead"],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ from .issue import (
|
||||||
IssueCreateSerializer,
|
IssueCreateSerializer,
|
||||||
IssueActivitySerializer,
|
IssueActivitySerializer,
|
||||||
IssueCommentSerializer,
|
IssueCommentSerializer,
|
||||||
IssuePropertySerializer,
|
IssueUserPropertySerializer,
|
||||||
IssueAssigneeSerializer,
|
IssueAssigneeSerializer,
|
||||||
LabelSerializer,
|
LabelSerializer,
|
||||||
IssueSerializer,
|
IssueSerializer,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ from plane.db.models import (
|
||||||
Issue,
|
Issue,
|
||||||
IssueActivity,
|
IssueActivity,
|
||||||
IssueComment,
|
IssueComment,
|
||||||
IssueProperty,
|
IssueUserProperty,
|
||||||
IssueAssignee,
|
IssueAssignee,
|
||||||
IssueSubscriber,
|
IssueSubscriber,
|
||||||
IssueLabel,
|
IssueLabel,
|
||||||
|
|
@ -252,9 +252,9 @@ class IssueActivitySerializer(BaseSerializer):
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
class IssuePropertySerializer(BaseSerializer):
|
class IssueUserPropertySerializer(BaseSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IssueProperty
|
model = IssueUserProperty
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
read_only_fields = [
|
read_only_fields = [
|
||||||
"user",
|
"user",
|
||||||
|
|
|
||||||
|
|
@ -233,13 +233,13 @@ urlpatterns = [
|
||||||
name="project-issue-comment-reactions",
|
name="project-issue-comment-reactions",
|
||||||
),
|
),
|
||||||
## End Comment Reactions
|
## End Comment Reactions
|
||||||
## IssueProperty
|
## IssueUserProperty
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/projects/<uuid:project_id>/user-properties/",
|
"workspaces/<str:slug>/projects/<uuid:project_id>/user-properties/",
|
||||||
IssueUserDisplayPropertyEndpoint.as_view(),
|
IssueUserDisplayPropertyEndpoint.as_view(),
|
||||||
name="project-issue-display-properties",
|
name="project-issue-display-properties",
|
||||||
),
|
),
|
||||||
## IssueProperty End
|
## IssueUserProperty End
|
||||||
## Issue Archives
|
## Issue Archives
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/projects/<uuid:project_id>/archived-issues/",
|
"workspaces/<str:slug>/projects/<uuid:project_id>/archived-issues/",
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ from plane.app.permissions import (
|
||||||
from plane.app.serializers import (
|
from plane.app.serializers import (
|
||||||
IssueCreateSerializer,
|
IssueCreateSerializer,
|
||||||
IssueDetailSerializer,
|
IssueDetailSerializer,
|
||||||
IssuePropertySerializer,
|
IssueUserPropertySerializer,
|
||||||
IssueSerializer,
|
IssueSerializer,
|
||||||
)
|
)
|
||||||
from plane.bgtasks.issue_activites_task import issue_activity
|
from plane.bgtasks.issue_activites_task import issue_activity
|
||||||
|
|
@ -40,7 +40,7 @@ from plane.db.models import (
|
||||||
Issue,
|
Issue,
|
||||||
IssueAttachment,
|
IssueAttachment,
|
||||||
IssueLink,
|
IssueLink,
|
||||||
IssueProperty,
|
IssueUserProperty,
|
||||||
IssueReaction,
|
IssueReaction,
|
||||||
IssueSubscriber,
|
IssueSubscriber,
|
||||||
Project,
|
Project,
|
||||||
|
|
@ -570,7 +570,7 @@ class IssueUserDisplayPropertyEndpoint(BaseAPIView):
|
||||||
]
|
]
|
||||||
|
|
||||||
def patch(self, request, slug, project_id):
|
def patch(self, request, slug, project_id):
|
||||||
issue_property = IssueProperty.objects.get(
|
issue_property = IssueUserProperty.objects.get(
|
||||||
user=request.user,
|
user=request.user,
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
)
|
)
|
||||||
|
|
@ -585,14 +585,14 @@ class IssueUserDisplayPropertyEndpoint(BaseAPIView):
|
||||||
"display_properties", issue_property.display_properties
|
"display_properties", issue_property.display_properties
|
||||||
)
|
)
|
||||||
issue_property.save()
|
issue_property.save()
|
||||||
serializer = IssuePropertySerializer(issue_property)
|
serializer = IssueUserPropertySerializer(issue_property)
|
||||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||||
|
|
||||||
def get(self, request, slug, project_id):
|
def get(self, request, slug, project_id):
|
||||||
issue_property, _ = IssueProperty.objects.get_or_create(
|
issue_property, _ = IssueUserProperty.objects.get_or_create(
|
||||||
user=request.user, project_id=project_id
|
user=request.user, project_id=project_id
|
||||||
)
|
)
|
||||||
serializer = IssuePropertySerializer(issue_property)
|
serializer = IssueUserPropertySerializer(issue_property)
|
||||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ from plane.db.models import (
|
||||||
Cycle,
|
Cycle,
|
||||||
Inbox,
|
Inbox,
|
||||||
DeployBoard,
|
DeployBoard,
|
||||||
IssueProperty,
|
IssueUserProperty,
|
||||||
Issue,
|
Issue,
|
||||||
Module,
|
Module,
|
||||||
Project,
|
Project,
|
||||||
|
|
@ -266,7 +266,7 @@ class ProjectViewSet(BaseViewSet):
|
||||||
role=20,
|
role=20,
|
||||||
)
|
)
|
||||||
# Also create the issue property for the user
|
# Also create the issue property for the user
|
||||||
_ = IssueProperty.objects.create(
|
_ = IssueUserProperty.objects.create(
|
||||||
project_id=serializer.data["id"],
|
project_id=serializer.data["id"],
|
||||||
user=request.user,
|
user=request.user,
|
||||||
)
|
)
|
||||||
|
|
@ -280,7 +280,7 @@ class ProjectViewSet(BaseViewSet):
|
||||||
role=20,
|
role=20,
|
||||||
)
|
)
|
||||||
# Also create the issue property for the user
|
# Also create the issue property for the user
|
||||||
IssueProperty.objects.create(
|
IssueUserProperty.objects.create(
|
||||||
project_id=serializer.data["id"],
|
project_id=serializer.data["id"],
|
||||||
user_id=serializer.data["project_lead"],
|
user_id=serializer.data["project_lead"],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ from plane.db.models import (
|
||||||
ProjectMemberInvite,
|
ProjectMemberInvite,
|
||||||
User,
|
User,
|
||||||
WorkspaceMember,
|
WorkspaceMember,
|
||||||
IssueProperty,
|
IssueUserProperty,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -179,9 +179,9 @@ class UserProjectInvitationsViewset(BaseViewSet):
|
||||||
ignore_conflicts=True,
|
ignore_conflicts=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
IssueProperty.objects.bulk_create(
|
IssueUserProperty.objects.bulk_create(
|
||||||
[
|
[
|
||||||
IssueProperty(
|
IssueUserProperty(
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
user=request.user,
|
user=request.user,
|
||||||
workspace=workspace,
|
workspace=workspace,
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ from plane.db.models import (
|
||||||
ProjectMember,
|
ProjectMember,
|
||||||
Workspace,
|
Workspace,
|
||||||
TeamMember,
|
TeamMember,
|
||||||
IssueProperty,
|
IssueUserProperty,
|
||||||
)
|
)
|
||||||
from plane.bgtasks.project_add_user_email_task import project_add_user_email
|
from plane.bgtasks.project_add_user_email_task import project_add_user_email
|
||||||
from plane.utils.host import base_host
|
from plane.utils.host import base_host
|
||||||
|
|
@ -136,7 +136,7 @@ class ProjectMemberViewSet(BaseViewSet):
|
||||||
)
|
)
|
||||||
# Create a new issue property
|
# Create a new issue property
|
||||||
bulk_issue_props.append(
|
bulk_issue_props.append(
|
||||||
IssueProperty(
|
IssueUserProperty(
|
||||||
user_id=member.get("member_id"),
|
user_id=member.get("member_id"),
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
workspace_id=project.workspace_id,
|
workspace_id=project.workspace_id,
|
||||||
|
|
@ -150,7 +150,7 @@ class ProjectMemberViewSet(BaseViewSet):
|
||||||
ignore_conflicts=True,
|
ignore_conflicts=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
_ = IssueProperty.objects.bulk_create(
|
_ = IssueUserProperty.objects.bulk_create(
|
||||||
bulk_issue_props, batch_size=10, ignore_conflicts=True
|
bulk_issue_props, batch_size=10, ignore_conflicts=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -323,7 +323,7 @@ class AddTeamToProjectEndpoint(BaseAPIView):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
issue_props.append(
|
issue_props.append(
|
||||||
IssueProperty(
|
IssueUserProperty(
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
user_id=member,
|
user_id=member,
|
||||||
workspace=workspace,
|
workspace=workspace,
|
||||||
|
|
@ -335,7 +335,7 @@ class AddTeamToProjectEndpoint(BaseAPIView):
|
||||||
project_members, batch_size=10, ignore_conflicts=True
|
project_members, batch_size=10, ignore_conflicts=True
|
||||||
)
|
)
|
||||||
|
|
||||||
_ = IssueProperty.objects.bulk_create(
|
_ = IssueUserProperty.objects.bulk_create(
|
||||||
issue_props, batch_size=10, ignore_conflicts=True
|
issue_props, batch_size=10, ignore_conflicts=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
# Generated by Django 4.2.11 on 2024-07-15 06:07
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("db", "0070_apitoken_is_service_exporterhistory_filters_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameModel(
|
||||||
|
old_name="IssueProperty",
|
||||||
|
new_name="IssueUserProperty",
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="issueuserproperty",
|
||||||
|
options={
|
||||||
|
"ordering": ("-created_at",),
|
||||||
|
"verbose_name": "Issue User Property",
|
||||||
|
"verbose_name_plural": "Issue User Properties",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name="issueuserproperty",
|
||||||
|
table="issue_user_properties",
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="issuetype",
|
||||||
|
name="is_active",
|
||||||
|
field=models.BooleanField(default=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="project",
|
||||||
|
name="is_issue_type_enabled",
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="issuetype",
|
||||||
|
name="is_default",
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -29,7 +29,7 @@ from .issue import (
|
||||||
IssueLabel,
|
IssueLabel,
|
||||||
IssueLink,
|
IssueLink,
|
||||||
IssueMention,
|
IssueMention,
|
||||||
IssueProperty,
|
IssueUserProperty,
|
||||||
IssueReaction,
|
IssueReaction,
|
||||||
IssueRelation,
|
IssueRelation,
|
||||||
IssueSequence,
|
IssueSequence,
|
||||||
|
|
|
||||||
|
|
@ -493,7 +493,7 @@ class IssueComment(ProjectBaseModel):
|
||||||
return str(self.issue)
|
return str(self.issue)
|
||||||
|
|
||||||
|
|
||||||
class IssueProperty(ProjectBaseModel):
|
class IssueUserProperty(ProjectBaseModel):
|
||||||
user = models.ForeignKey(
|
user = models.ForeignKey(
|
||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
|
|
@ -506,9 +506,9 @@ class IssueProperty(ProjectBaseModel):
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Issue Property"
|
verbose_name = "Issue User Property"
|
||||||
verbose_name_plural = "Issue Properties"
|
verbose_name_plural = "Issue User Properties"
|
||||||
db_table = "issue_properties"
|
db_table = "issue_user_properties"
|
||||||
ordering = ("-created_at",)
|
ordering = ("-created_at",)
|
||||||
unique_together = ["user", "project"]
|
unique_together = ["user", "project"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,9 @@ class IssueType(WorkspaceBaseModel):
|
||||||
description = models.TextField(blank=True)
|
description = models.TextField(blank=True)
|
||||||
logo_props = models.JSONField(default=dict)
|
logo_props = models.JSONField(default=dict)
|
||||||
sort_order = models.FloatField(default=65535)
|
sort_order = models.FloatField(default=65535)
|
||||||
is_default = models.BooleanField(default=True)
|
is_default = models.BooleanField(default=False)
|
||||||
weight = models.PositiveIntegerField(default=0)
|
weight = models.PositiveIntegerField(default=0)
|
||||||
|
is_active = models.BooleanField(default=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ["project", "name"]
|
unique_together = ["project", "name"]
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ class Project(BaseModel):
|
||||||
page_view = models.BooleanField(default=True)
|
page_view = models.BooleanField(default=True)
|
||||||
inbox_view = models.BooleanField(default=False)
|
inbox_view = models.BooleanField(default=False)
|
||||||
is_time_tracking_enabled = models.BooleanField(default=False)
|
is_time_tracking_enabled = models.BooleanField(default=False)
|
||||||
|
is_issue_type_enabled = models.BooleanField(default=False)
|
||||||
cover_image = models.URLField(blank=True, null=True, max_length=800)
|
cover_image = models.URLField(blank=True, null=True, max_length=800)
|
||||||
estimate = models.ForeignKey(
|
estimate = models.ForeignKey(
|
||||||
"db.Estimate",
|
"db.Estimate",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue