Files
crm-system/app/schemas/user.py
T

38 lines
747 B
Python
Raw Normal View History

"""User schemas."""
2026-06-04 00:06:23 +00:00
from __future__ import annotations
from typing import Any
2026-06-04 00:06:23 +00:00
from pydantic import BaseModel, EmailStr, Field
2026-06-04 00:06:23 +00:00
class UserCreate(BaseModel):
2026-06-04 00:06:23 +00:00
email: EmailStr
name: str = Field(..., min_length=1, max_length=200)
password: str = Field(..., min_length=8)
role: str = Field(default="viewer")
is_active: bool = True
2026-06-04 00:06:23 +00:00
class UserUpdate(BaseModel):
name: str | None = Field(None, min_length=1, max_length=200)
role: str | None = None
is_active: bool | None = None
2026-06-04 00:06:23 +00:00
class UserResponse(BaseModel):
id: str
email: str
name: str
role: str
is_active: bool
tenant_id: str
2026-06-04 00:06:23 +00:00
class PaginatedUsers(BaseModel):
items: list[UserResponse]
2026-06-04 00:06:23 +00:00
total: int
page: int
page_size: int