ФУНКЦИИ - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: администрирование воркспейсов и feature-gates в God Mode
This commit is contained in:
@@ -260,6 +260,36 @@ class WorkspaceMemberInvite(BaseModel):
|
||||
return f"{self.workspace.name} {self.email} {self.accepted}"
|
||||
|
||||
|
||||
class WorkspaceFeatureEntitlement(BaseModel):
|
||||
class FeatureKey(models.TextChoices):
|
||||
VOICE_TASKER = "voice_tasker", "AI / Voice Tasker"
|
||||
|
||||
workspace = models.ForeignKey(
|
||||
"db.Workspace",
|
||||
on_delete=models.CASCADE,
|
||||
related_name="feature_entitlements",
|
||||
)
|
||||
feature_key = models.CharField(max_length=80, choices=FeatureKey.choices)
|
||||
is_enabled = models.BooleanField(default=False)
|
||||
metadata = models.JSONField(default=dict, blank=True)
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["workspace", "feature_key"],
|
||||
condition=models.Q(deleted_at__isnull=True),
|
||||
name="workspace_feature_entitlement_unique_active_feature",
|
||||
)
|
||||
]
|
||||
verbose_name = "Workspace Feature Entitlement"
|
||||
verbose_name_plural = "Workspace Feature Entitlements"
|
||||
db_table = "workspace_feature_entitlements"
|
||||
ordering = ("-created_at",)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.workspace.slug} <{self.feature_key}>"
|
||||
|
||||
|
||||
class Team(BaseModel):
|
||||
name = models.CharField(max_length=255, verbose_name="Team Name")
|
||||
description = models.TextField(verbose_name="Team Description", blank=True)
|
||||
|
||||
Reference in New Issue
Block a user