From bbc7c1b33cfc87e6c9b9fab76875da8b44871464 Mon Sep 17 00:00:00 2001 From: chihlasm Date: Thu, 5 Mar 2026 01:43:04 -0500 Subject: [PATCH] feat: add survey invite schemas and token field Co-Authored-By: Claude Opus 4.6 --- backend/app/schemas/survey.py | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 backend/app/schemas/survey.py diff --git a/backend/app/schemas/survey.py b/backend/app/schemas/survey.py new file mode 100644 index 00000000..0aac7fac --- /dev/null +++ b/backend/app/schemas/survey.py @@ -0,0 +1,46 @@ +"""Schemas for FlowPilot survey submission.""" +from datetime import datetime +from typing import Any, Optional +from pydantic import BaseModel, Field + + +class SurveySubmission(BaseModel): + """Incoming survey response from the public form.""" + respondent_name: Optional[str] = Field(None, max_length=255) + responses: dict[str, Any] = Field( + ..., + description="Question ID -> answer mapping. Values can be strings, lists, or numbers.", + ) + token: Optional[str] = Field(None, description="Invite token for tracking") + + +class SurveySubmissionResponse(BaseModel): + """Response after successful submission.""" + message: str = "Thank you for your response!" + id: str + + +class SurveyInviteCreate(BaseModel): + """Create a new survey invite.""" + recipient_name: str = Field(..., min_length=1, max_length=255) + recipient_email: Optional[str] = Field(None, max_length=255) + send_email: bool = False + + +class SurveyInviteResponse(BaseModel): + """Invite details returned to admin.""" + id: str + token: str + recipient_name: str + recipient_email: Optional[str] + status: str + email_sent: bool + created_at: datetime + completed_at: Optional[datetime] + survey_url: str + + +class SurveyInviteStatus(BaseModel): + """Public invite status check — minimal info.""" + name: str + status: str