Backend (FastAPI + Python 3.12): - Multi-tenant auth with JWT: login, register, refresh, Meta OAuth - Business & BusinessConfig management - WhatsApp webhook with HMAC signature verification - Bot engine powered by Claude AI - Calendar availability with Redis caching - Reservations CRUD with status management - Dashboard analytics (stats, agenda, peak hours) - Billing & plan management - Admin panel with platform-wide stats - Async bcrypt via asyncio.to_thread - IntegrityError handling for concurrent registration race conditions Frontend (React 18 + Vite + Tailwind CSS): - Multi-step guided registration form with helper text on every field - Login page with show/hide password toggle - Protected routes with AuthContext - Dashboard with stats cards, bar chart, and daily agenda - Reservations list with search, filters, and inline status actions - Calendar with weekly view, slot availability, and date blocking - Config page: business info, schedules, bot personality - Billing page with plan comparison and usage bar Design system: - Bricolage Grotesque + DM Sans typography - Emerald primary palette with semantic color tokens - scale(0.97) button press feedback, ease-out animations - Skeleton loaders, stagger animations, prefers-reduced-motion support - Accessible: aria-labels, visible focus rings, 4.5:1 contrast Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
57 lines
1.1 KiB
Python
57 lines
1.1 KiB
Python
from pydantic import BaseModel, EmailStr, field_validator
|
|
|
|
|
|
class RegisterRequest(BaseModel):
|
|
business_name: str
|
|
business_type: str
|
|
timezone: str = "UTC"
|
|
email: EmailStr
|
|
password: str
|
|
|
|
@field_validator("password")
|
|
@classmethod
|
|
def password_strength(cls, v: str) -> str:
|
|
if len(v) < 8:
|
|
raise ValueError("La contraseña debe tener al menos 8 caracteres")
|
|
return v
|
|
|
|
@field_validator("business_name")
|
|
@classmethod
|
|
def business_name_not_empty(cls, v: str) -> str:
|
|
if not v.strip():
|
|
raise ValueError("El nombre del negocio no puede estar vacío")
|
|
return v.strip()
|
|
|
|
|
|
class TokenResponse(BaseModel):
|
|
access_token: str
|
|
token_type: str = "bearer"
|
|
|
|
|
|
class RegisterResponse(TokenResponse):
|
|
business_id: int
|
|
user_id: int
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
|
email: EmailStr
|
|
password: str
|
|
|
|
|
|
class RefreshRequest(BaseModel):
|
|
access_token: str
|
|
|
|
|
|
class MetaCallbackRequest(BaseModel):
|
|
code: str
|
|
redirect_uri: str
|
|
|
|
|
|
class UserRead(BaseModel):
|
|
id: int
|
|
business_id: int
|
|
email: str
|
|
role: str
|
|
|
|
model_config = {"from_attributes": True}
|