first commit
This commit is contained in:
commit
6e354ba041
109 changed files with 12110 additions and 0 deletions
59
backend/app/schemas/user.py
Normal file
59
backend/app/schemas/user.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, EmailStr, Field
|
||||
|
||||
|
||||
class UserBase(BaseModel):
|
||||
email: EmailStr
|
||||
username: str = Field(min_length=3, max_length=100)
|
||||
full_name: str = Field(min_length=1, max_length=255)
|
||||
employee_id: str | None = Field(default=None, max_length=100)
|
||||
phone: str | None = Field(default=None, max_length=50)
|
||||
occupation: str | None = Field(default=None, max_length=150)
|
||||
|
||||
|
||||
class UserCreate(UserBase):
|
||||
password: str = Field(min_length=8, max_length=128)
|
||||
|
||||
|
||||
class UserUpdate(BaseModel):
|
||||
full_name: str | None = Field(default=None, min_length=1, max_length=255)
|
||||
employee_id: str | None = Field(default=None, max_length=100)
|
||||
phone: str | None = Field(default=None, max_length=50)
|
||||
occupation: str | None = Field(default=None, max_length=150)
|
||||
|
||||
|
||||
class UserResponse(UserBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
is_active: bool
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class LoginRequest(BaseModel):
|
||||
username_or_email: str = Field(min_length=1)
|
||||
password: str = Field(min_length=1)
|
||||
remember_me: bool = False
|
||||
|
||||
|
||||
class TokenResponse(BaseModel):
|
||||
access_token: str
|
||||
refresh_token: str
|
||||
token_type: str = "bearer"
|
||||
user: UserResponse
|
||||
|
||||
|
||||
class ForgotPasswordRequest(BaseModel):
|
||||
email: EmailStr
|
||||
|
||||
|
||||
class ResetPasswordRequest(BaseModel):
|
||||
token: str
|
||||
new_password: str = Field(min_length=8, max_length=128)
|
||||
|
||||
|
||||
class MessageResponse(BaseModel):
|
||||
message: str
|
||||
reset_token: str | None = None
|
||||
Loading…
Add table
Add a link
Reference in a new issue