bLOQUE p1 BACKEND Y SEGURIDAD, AUTENTICACION CON SUPABASE. jwt. RBAC CRUD

This commit is contained in:
shinra32
2026-05-22 19:45:05 -06:00
parent 5dc8390855
commit fc28333e3f
52 changed files with 1605 additions and 109 deletions

View File

View File

@@ -0,0 +1,21 @@
from pydantic import BaseModel
from typing import Optional
class AddressCreate(BaseModel):
label: str
calle: str
colonia: str # el backend deriva route_id a partir de colonias-rutas.json
class AddressResponse(BaseModel):
id: str
user_id: str
label: str
calle: str
colonia: str
route_id: str
verified: bool
verified_method: Optional[str] = None
verified_at: Optional[str] = None
created_at: Optional[str] = None

View File

@@ -0,0 +1,22 @@
from pydantic import BaseModel, EmailStr
from typing import Optional, Literal
class RegisterRequest(BaseModel):
email: Optional[str] = None
phone: Optional[str] = None
password: str
role: Literal["citizen", "driver", "admin"] = "citizen"
class LoginRequest(BaseModel):
email: Optional[str] = None
phone: Optional[str] = None
password: str
class TokenResponse(BaseModel):
access_token: str
token_type: str = "bearer"
user_id: str
role: str

View File

@@ -0,0 +1,8 @@
from pydantic import BaseModel
class ColoniaResponse(BaseModel):
colonia: str
routeId: str
turno: str | None = None
horario_estimado: str | None = None