first commit
This commit is contained in:
18
backend/app/models/user.py
Normal file
18
backend/app/models/user.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from enum import Enum
|
||||
from sqlalchemy import String, Boolean, Enum as SAEnum
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.core.db import Base
|
||||
|
||||
class UserRole(str, Enum):
|
||||
ADMIN = "admin"
|
||||
USER = "user"
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = "users"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
||||
email: Mapped[str] = mapped_column(String(255), unique=True, index=True)
|
||||
password_hash: Mapped[str] = mapped_column(String(255))
|
||||
role: Mapped[UserRole] = mapped_column(SAEnum(UserRole), default=UserRole.USER)
|
||||
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
||||
Reference in New Issue
Block a user