aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2025-05-31 16:49:36 +0100
committerGravatar Joe Banks <[email protected]>2025-05-31 16:50:39 +0100
commitc4d3bfd7cd06fd2bea3349f0e514e34900272b29 (patch)
tree1c697c5efd41507f6a6ae4b9fbf2c62f186b5b8f
parentUse redis role cache when validating access to form resources (diff)
Add webhook thread ID to form model
-rw-r--r--backend/models/form.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/backend/models/form.py b/backend/models/form.py
index 739464e..70a77a9 100644
--- a/backend/models/form.py
+++ b/backend/models/form.py
@@ -24,6 +24,7 @@ class _WebHook(BaseModel):
url: str
message: str | None
+ thread_id: str | None = None
@validator("url")
def validate_url(cls, url: str) -> str:
@@ -34,6 +35,15 @@ class _WebHook(BaseModel):
return url
+ @validator("thread_id")
+ def validate_thread_id(cls, thread_id: str | None) -> str | None:
+ """Validates thread_id parameter."""
+ if thread_id is not None and not thread_id.isdigit():
+ msg = "Thread ID must be a string of digits."
+ raise ValueError(msg)
+
+ return thread_id
+
class Form(BaseModel):
"""Schema model for form."""