Skip to content

Commit

Permalink
Add is_researcher boolean flag to User
Browse files Browse the repository at this point in the history
  • Loading branch information
lkeegan committed Sep 26, 2024
1 parent bbea732 commit 2511706
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mondey_backend/src/mondey_backend/models/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from fastapi_users import schemas
from fastapi_users.db import SQLAlchemyBaseUserTable
from fastapi_users_db_sqlalchemy.access_token import SQLAlchemyBaseAccessTokenTable
from sqlalchemy import Boolean
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy.orm import DeclarativeBase
Expand All @@ -17,18 +18,19 @@ class Base(DeclarativeBase):

class User(SQLAlchemyBaseUserTable[int], Base):
id: Mapped[int] = mapped_column(Integer, primary_key=True)
is_researcher: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)


class UserRead(schemas.BaseUser[int]):
pass
is_researcher: bool


class UserCreate(schemas.BaseUserCreate):
pass
is_researcher: bool | None = False


class UserUpdate(schemas.BaseUserUpdate):
pass
is_researcher: bool | None = None


class AccessToken(SQLAlchemyBaseAccessTokenTable[int], Base):
Expand Down

0 comments on commit 2511706

Please sign in to comment.