From 5216f184c1d2c266c448bd3aa365b2735b1095ae Mon Sep 17 00:00:00 2001 From: NarayanBavisetti Date: Fri, 6 Oct 2023 12:00:18 +0530 Subject: [PATCH] fix: page transaction model --- apiserver/plane/db/models/page.py | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/apiserver/plane/db/models/page.py b/apiserver/plane/db/models/page.py index 557fcb323..8efd864e4 100644 --- a/apiserver/plane/db/models/page.py +++ b/apiserver/plane/db/models/page.py @@ -22,6 +22,15 @@ class Page(ProjectBaseModel): labels = models.ManyToManyField( "db.Label", blank=True, related_name="pages", through="db.PageLabel" ) + parent = models.ForeignKey( + "self", + on_delete=models.CASCADE, + null=True, + blank=True, + related_name="parent_page", + ) + archived_at = models.DateField(null=True) + is_locked = models.BooleanField(default=False) class Meta: verbose_name = "Page" @@ -34,6 +43,42 @@ class Page(ProjectBaseModel): return f"{self.owned_by.email} <{self.name}>" +class PageTransaction(ProjectBaseModel): + TYPE_CHOICES = ( + ("to_do", "To Do"), + ("issue", "issue"), + ("image", "Image"), + ("video", "Video"), + ("file", "File"), + ("link", "Link"), + ("cycle","Cycle"), + ("module", "Module"), + ("back_link", "Back Link"), + ("forward_link", "Forward Link"), + ("mention", "Mention"), + ) + transaction = models.CharField(max_length=255) + page = models.ForeignKey( + Page, related_name="page_relation", on_delete=models.CASCADE + ) + entity_identifier = models.UUIDField(null=True) + entity_name = models.CharField( + max_length=30, + choices=TYPE_CHOICES, + verbose_name="Transaction Type", + default="to_do", + ) + + class Meta: + verbose_name = "Page Transaction" + verbose_name_plural = "Page Transactions" + db_table = "page_transactions" + ordering = ("-created_at",) + + def __str__(self): + return f"{self.page.name} {self.type}" + + class PageBlock(ProjectBaseModel): page = models.ForeignKey("db.Page", on_delete=models.CASCADE, related_name="blocks") name = models.CharField(max_length=255)