mirror of
https://github.com/mblanke/ThreatHunt.git
synced 2026-03-01 22:00:22 -05:00
34 lines
695 B
Python
34 lines
695 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
|
|
|
|
class UserBase(BaseModel):
|
|
"""Base user schema"""
|
|
username: str
|
|
role: str = "user"
|
|
tenant_id: int
|
|
|
|
|
|
class UserCreate(UserBase):
|
|
"""Schema for creating a user"""
|
|
password: str
|
|
|
|
|
|
class UserUpdate(BaseModel):
|
|
"""Schema for updating a user"""
|
|
username: Optional[str] = None
|
|
password: Optional[str] = None
|
|
role: Optional[str] = None
|
|
is_active: Optional[bool] = None
|
|
|
|
|
|
class UserRead(UserBase):
|
|
"""Schema for reading user data (excludes password_hash)"""
|
|
id: int
|
|
is_active: bool
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|