Skip to content

Commit

Permalink
feat: admin user
Browse files Browse the repository at this point in the history
  • Loading branch information
natilou committed Sep 5, 2023
1 parent db80e9b commit f908b92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sqlalchemy import ForeignKey, Table
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship

from utils import Status
from utils import Status, UserRole


class Base(DeclarativeBase):
Expand All @@ -20,9 +20,7 @@ class User(Base):
last_name: Mapped[str]
email: Mapped[str] = mapped_column(unique=True)
active: Mapped[bool] = mapped_column(default=False)


# TODO: create admin user
role: Mapped[str] = mapped_column(SqlAlchemyEnum(UserRole), default=UserRole.USER)


class Metric(Base):
Expand Down
5 changes: 5 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@
class Status(enum.Enum):
ACTIVE = "active"
COMPLETED = "completed"


class UserRole(enum.Enum):
ADMIN = "admin"
USER = "user"

0 comments on commit f908b92

Please sign in to comment.