Skip to content

Commit c4d3bfd

Browse files
committed
Add webhook thread ID to form model
1 parent df05afa commit c4d3bfd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

backend/models/form.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class _WebHook(BaseModel):
2424

2525
url: str
2626
message: str | None
27+
thread_id: str | None = None
2728

2829
@validator("url")
2930
def validate_url(cls, url: str) -> str:
@@ -34,6 +35,15 @@ def validate_url(cls, url: str) -> str:
3435

3536
return url
3637

38+
@validator("thread_id")
39+
def validate_thread_id(cls, thread_id: str | None) -> str | None:
40+
"""Validates thread_id parameter."""
41+
if thread_id is not None and not thread_id.isdigit():
42+
msg = "Thread ID must be a string of digits."
43+
raise ValueError(msg)
44+
45+
return thread_id
46+
3747

3848
class Form(BaseModel):
3949
"""Schema model for form."""

0 commit comments

Comments
 (0)