25 lines
727 B
Python
25 lines
727 B
Python
from __future__ import annotations
|
|
|
|
import enum
|
|
|
|
from sqlalchemy import Boolean, Enum, String
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.db.base import Base, TimestampMixin, UUIDMixin
|
|
|
|
|
|
class UserRole(str, enum.Enum):
|
|
admin = "admin"
|
|
employee = "employee"
|
|
auditor = "auditor"
|
|
|
|
|
|
class User(Base, UUIDMixin, TimestampMixin):
|
|
__tablename__ = "users"
|
|
|
|
email: Mapped[str] = mapped_column(String(255), unique=True, index=True)
|
|
full_name: Mapped[str] = mapped_column(String(160))
|
|
role: Mapped[UserRole] = mapped_column(Enum(UserRole), default=UserRole.employee)
|
|
password_hash: Mapped[str] = mapped_column(String(255))
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
|