feat: add SurveyInvite model
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,8 @@ from app.models.email_verification_token import EmailVerificationToken
|
||||
from app.models.tree_embedding import TreeEmbedding
|
||||
from app.models.copilot_conversation import CopilotConversation
|
||||
from app.models.assistant_chat import AssistantChat
|
||||
from app.models.survey_response import SurveyResponse
|
||||
from app.models.survey_invite import SurveyInvite
|
||||
from app.core.config import settings
|
||||
|
||||
# this is the Alembic Config object
|
||||
|
||||
@@ -32,6 +32,8 @@ from .ai_chat_session import AIChatSession
|
||||
from .tree_embedding import TreeEmbedding
|
||||
from .copilot_conversation import CopilotConversation
|
||||
from .assistant_chat import AssistantChat
|
||||
from .survey_response import SurveyResponse
|
||||
from .survey_invite import SurveyInvite
|
||||
|
||||
__all__ = [
|
||||
"User",
|
||||
@@ -75,4 +77,6 @@ __all__ = [
|
||||
"TreeEmbedding",
|
||||
"CopilotConversation",
|
||||
"AssistantChat",
|
||||
"SurveyResponse",
|
||||
"SurveyInvite",
|
||||
]
|
||||
|
||||
26
backend/app/models/survey_invite.py
Normal file
26
backend/app/models/survey_invite.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""Survey invite tracking for FlowPilot research."""
|
||||
import secrets
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from sqlalchemy import Boolean, Column, DateTime, String
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
def _generate_token() -> str:
|
||||
return secrets.token_urlsafe(16)
|
||||
|
||||
|
||||
class SurveyInvite(Base):
|
||||
__tablename__ = "survey_invites"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
token = Column(String(32), unique=True, nullable=False, default=_generate_token)
|
||||
recipient_name = Column(String(255), nullable=False)
|
||||
recipient_email = Column(String(255), nullable=True)
|
||||
status = Column(String(20), nullable=False, default="pending")
|
||||
email_sent = Column(Boolean, nullable=False, default=False)
|
||||
created_at = Column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc), nullable=False)
|
||||
completed_at = Column(DateTime(timezone=True), nullable=True)
|
||||
Reference in New Issue
Block a user