feat(users): add user administration and password management
This commit is contained in:
parent
47f54d3461
commit
b584e60273
16 changed files with 720 additions and 22 deletions
|
|
@ -1,5 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, EmailStr
|
||||
|
||||
from app.models.user import UserRole
|
||||
|
|
@ -18,7 +20,16 @@ class TokenResponse(BaseModel):
|
|||
|
||||
class UserRead(EntityRead):
|
||||
email: EmailStr
|
||||
full_name: str
|
||||
first_name: str
|
||||
last_name: str
|
||||
role: UserRole
|
||||
is_active: bool
|
||||
must_change_password: bool
|
||||
last_login_at: datetime | None = None
|
||||
password_changed_at: datetime | None = None
|
||||
|
||||
|
||||
class ChangePasswordRequest(BaseModel):
|
||||
current_password: str
|
||||
new_password: str
|
||||
new_password_confirmation: str
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from datetime import date
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import EmailStr, Field, field_validator
|
||||
|
||||
from app.models.customer import CustomerType
|
||||
from app.models.equipment import EquipmentKind, EquipmentStatus
|
||||
from app.models.user import UserRole
|
||||
from app.models.validation import ValidationStatus
|
||||
from app.schemas.common import EntityRead, ORMModel
|
||||
|
||||
|
|
@ -241,3 +243,29 @@ class MeasurementImportValueConfirm(ORMModel):
|
|||
|
||||
class MeasurementImportConfirmRequest(ORMModel):
|
||||
values: list[MeasurementImportValueConfirm]
|
||||
|
||||
|
||||
class UserBase(ORMModel):
|
||||
first_name: str
|
||||
last_name: str
|
||||
email: EmailStr
|
||||
role: UserRole
|
||||
is_active: bool = True
|
||||
must_change_password: bool = True
|
||||
|
||||
|
||||
class UserCreate(UserBase):
|
||||
temporary_password: str
|
||||
|
||||
|
||||
class UserUpdate(UserBase):
|
||||
pass
|
||||
|
||||
|
||||
class UserRead(UserBase, EntityRead):
|
||||
last_login_at: datetime | None = None
|
||||
password_changed_at: datetime | None = None
|
||||
|
||||
|
||||
class UserPasswordResetRequest(ORMModel):
|
||||
temporary_password: str | None = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue