fix(pilot): replace pydantic EmailStr with str+regex (email-validator dep missing → backend startup ImportError → deploy unhealthy)
Root cause: PR #330 SF-B3 introduced pydantic EmailStr import in backend/app/api/v1/pilot.py at module level. EmailStr requires the email-validator package which is not in pyproject deps, so backend import crashed: pydantic.errors.PydanticImportError: `email-validator` is not installed Result: backend container started but uvicorn import failed → /health endpoint never bound → docker-compose marked container unhealthy → deploy exited 1. Fix: drop EmailStr, use plain `str | None` with a minimal regex pattern. Strict email validation can run on the frontend or CRM side.
This commit is contained in:
parent
dbeed80b26
commit
31e686e4d3
1 changed files with 5 additions and 2 deletions
|
|
@ -11,7 +11,7 @@ import logging
|
|||
from typing import Annotated, Any, Literal
|
||||
|
||||
from fastapi import APIRouter, Depends, Request
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
from pydantic import BaseModel, Field
|
||||
from sqlalchemy import text
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
|
|
@ -25,7 +25,10 @@ router = APIRouter()
|
|||
class PilotRequestInput(BaseModel):
|
||||
name: str = Field(min_length=2, max_length=200)
|
||||
phone: str | None = Field(default=None, max_length=50)
|
||||
email: EmailStr | None = None
|
||||
# Note: was EmailStr but `email-validator` package not in deps → ImportError
|
||||
# on backend startup → container unhealthy → whole deploy fails. Using plain
|
||||
# str + minimal regex; full validation can happen on frontend/CRM side.
|
||||
email: str | None = Field(default=None, max_length=200, pattern=r"^[^@\s]+@[^@\s]+\.[^@\s]+$")
|
||||
company: str | None = Field(default=None, max_length=200)
|
||||
message: str | None = Field(default=None, max_length=2000)
|
||||
source: Literal["landing", "analyze_page", "other"] = "landing"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue