Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apiserver/plane/app/serializers/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def update(self, instance, validated_data):
class Meta:
model = Webhook
fields = "__all__"
read_only_fields = ["workspace", "secret_key"]
read_only_fields = ["workspace", "secret_key", "deleted_at"]


class WebhookLogSerializer(DynamicBaseSerializer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,16 @@ class Migration(migrations.Migration):
name="entity_name",
field=models.CharField(max_length=30, verbose_name="Transaction Type"),
),
migrations.AlterUniqueTogether(
name="webhook",
unique_together={("workspace", "url", "deleted_at")},
),
migrations.AddConstraint(
model_name="webhook",
constraint=models.UniqueConstraint(
condition=models.Q(("deleted_at__isnull", True)),
fields=("workspace", "url"),
name="webhook_url_unique_url_when_deleted_at_null",
),
),
]
9 changes: 8 additions & 1 deletion apiserver/plane/db/models/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,18 @@ def __str__(self):
return f"{self.workspace.slug} {self.url}"

class Meta:
unique_together = ["workspace", "url"]
unique_together = ["workspace", "url", "deleted_at"]
verbose_name = "Webhook"
verbose_name_plural = "Webhooks"
db_table = "webhooks"
ordering = ("-created_at",)
constraints = [
models.UniqueConstraint(
fields=["workspace", "url"],
condition=models.Q(deleted_at__isnull=True),
name="webhook_url_unique_url_when_deleted_at_null",
)
]


class WebhookLog(BaseModel):
Expand Down
Loading