Subir archivos a "/"
This commit is contained in:
50
usuario.py
Normal file
50
usuario.py
Normal file
@@ -0,0 +1,50 @@
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class UsuarioBase(BaseModel):
|
||||
username: str = Field(..., min_length=3, max_length=50)
|
||||
email: EmailStr
|
||||
nombre_completo: Optional[str] = Field(None, max_length=255)
|
||||
|
||||
|
||||
class UsuarioCreate(UsuarioBase):
|
||||
password: str = Field(..., min_length=6)
|
||||
|
||||
|
||||
class UsuarioUpdate(BaseModel):
|
||||
email: Optional[EmailStr] = None
|
||||
nombre_completo: Optional[str] = Field(None, max_length=255)
|
||||
password: Optional[str] = Field(None, min_length=6)
|
||||
is_active: Optional[bool] = None
|
||||
|
||||
|
||||
class UsuarioResponse(UsuarioBase):
|
||||
id: int
|
||||
is_active: bool
|
||||
is_superuser: bool
|
||||
created_at: datetime
|
||||
last_login: Optional[datetime]
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class UsuarioInDB(UsuarioResponse):
|
||||
hashed_password: str
|
||||
|
||||
|
||||
# Schemas de autenticación
|
||||
class Token(BaseModel):
|
||||
access_token: str
|
||||
token_type: str
|
||||
|
||||
|
||||
class TokenData(BaseModel):
|
||||
username: Optional[str] = None
|
||||
|
||||
|
||||
class LoginRequest(BaseModel):
|
||||
username: str
|
||||
password: str
|
||||
Reference in New Issue
Block a user