From b3d0457f1022e1705d0dd03f9b242c397d7796fe Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Fri, 26 Apr 2024 18:27:04 +0530 Subject: [PATCH] dev: initiate sites --- apiserver/plane/db/models/workspace.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/apiserver/plane/db/models/workspace.py b/apiserver/plane/db/models/workspace.py index 7e5d6d90b..3b604793d 100644 --- a/apiserver/plane/db/models/workspace.py +++ b/apiserver/plane/db/models/workspace.py @@ -129,6 +129,23 @@ def slug_validator(value): raise ValidationError("Slug is not valid") +class Site(BaseModel): + name = models.CharField(max_length=80) + description = models.TextField(blank=True) + use_case = models.TextField(blank=True) + owner = models.ForeignKey( + settings.AUTH_USER_MODEL, + on_delete=models.CASCADE, + related_name="sites", + ) + domain = models.TextField(blank=True) + user_count = models.IntegerField(default=1) + + def __str__(self): + """Return name of site""" + return self.name + + class Workspace(BaseModel): name = models.CharField(max_length=80, verbose_name="Workspace Name") logo = models.URLField(verbose_name="Logo", blank=True, null=True) @@ -146,6 +163,9 @@ class Workspace(BaseModel): ], ) organization_size = models.CharField(max_length=20, blank=True, null=True) + site = models.ForeignKey( + "db.Site", on_delete=models.CASCADE, related_name="workspaces" + ) def __str__(self): """Return name of the Workspace"""