Spaces:
Sleeping
Sleeping
File size: 1,371 Bytes
e650b33 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | from pydantic import BaseModel, EmailStr
from typing import Optional
from datetime import datetime
class RegisterRequest(BaseModel):
"""
Schema for user registration request.
Attributes:
email: User's email address (must be valid email format)
password: User's password (minimum 8 characters will be validated in endpoint)
"""
email: EmailStr
password: str
class RegisterResponse(BaseModel):
"""
Schema for user registration response.
Attributes:
id: Unique identifier of the created user
email: Email address of the created user
created_at: Timestamp when the user was created
"""
id: str # UUID as string
email: EmailStr
created_at: datetime
class LoginRequest(BaseModel):
"""
Schema for user login request.
Attributes:
email: User's email address
password: User's password
"""
email: EmailStr
password: str
class LoginResponse(BaseModel):
"""
Schema for user login response.
Attributes:
access_token: JWT token for authentication
token_type: Type of token (usually "bearer")
user_id: Unique identifier of the authenticated user
email: Email address of the authenticated user
"""
access_token: str
token_type: str
user_id: str # UUID as string
email: EmailStr |