Merge pull request #57 from pablohashescobar/feat/project_default_props

feat: project view default props with migrations
This commit is contained in:
Vamsi Kurama 2022-12-21 23:28:45 +05:30 committed by GitHub
commit dc228a6a80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 1 deletions

View File

@ -609,7 +609,13 @@ class ProjectUserViewsEndpoint(BaseAPIView):
{"error": "Forbidden"}, status=status.HTTP_403_FORBIDDEN
)
project_member.view_props = request.data
view_props = project_member.view_props
default_props = project_member.default_props
project_member.view_props = request.data.get("view_props", view_props)
project_member.default_props = request.data.get(
"default_props", default_props
)
project_member.save()

View File

@ -0,0 +1,19 @@
# Generated by Django 3.2.14 on 2022-12-20 11:29
from django.db import migrations, models
import plane.db.models.project
class Migration(migrations.Migration):
dependencies = [
('db', '0012_user_my_issues_prop'),
]
operations = [
migrations.AddField(
model_name='projectmember',
name='default_props',
field=models.JSONField(default=plane.db.models.project.get_default_props),
),
]

View File

@ -19,6 +19,15 @@ ROLE_CHOICES = (
)
def get_default_props():
return {
"issueView": "list",
"groupByProperty": None,
"orderBy": None,
"filterIssue": None,
}
class Project(BaseModel):
NETWORK_CHOICES = ((0, "Secret"), (2, "Public"))
@ -119,6 +128,7 @@ class ProjectMember(ProjectBaseModel):
comment = models.TextField(blank=True, null=True)
role = models.PositiveSmallIntegerField(choices=ROLE_CHOICES, default=10)
view_props = models.JSONField(null=True)
default_props = models.JSONField(default=get_default_props)
class Meta:
unique_together = ["project", "member"]