Skip to content

Commit

Permalink
Add username to user model
Browse files Browse the repository at this point in the history
  • Loading branch information
noxethiems committed Oct 19, 2023
1 parent e8be57b commit 73b8c91
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions identity_socializer/db/dao/user_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async def create_user_model(
email: str,
first_name: Optional[str] = None,
last_name: Optional[str] = None,
username: Optional[str] = None,
phone_number: Optional[str] = None,
bio_msg: Optional[str] = None,
) -> None:
Expand All @@ -32,6 +33,7 @@ async def create_user_model(
user_model = UserModel(
first_name=first_name,
last_name=last_name,
username=username,
phone_number=phone_number,
bio_msg=bio_msg,
id=uid,
Expand All @@ -45,6 +47,7 @@ async def update_user_model(
uid: str,
first_name: Optional[str] = None,
last_name: Optional[str] = None,
username: Optional[str] = None,
phone_number: Optional[str] = None,
bio_msg: Optional[str] = None,
profile_photo_id: Optional[str] = None,
Expand All @@ -57,6 +60,7 @@ async def update_user_model(
.values(
first_name=first_name,
last_name=last_name,
username=username,
phone_number=phone_number,
bio_msg=bio_msg,
profile_photo_id=profile_photo_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def upgrade() -> None:
sa.Column("id", sa.String(), nullable=False),
sa.Column("first_name", sa.String(length=50), nullable=True),
sa.Column("last_name", sa.String(length=50), nullable=True),
sa.Column("username", sa.String(length=50), nullable=True),
sa.Column("phone_number", sa.String(length=20), nullable=True),
sa.Column("email", sa.String(length=50), nullable=False),
sa.Column("bio_msg", sa.String(length=200), nullable=True),
Expand Down
1 change: 1 addition & 0 deletions identity_socializer/db/models/user_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class UserModel(Base):
email: Mapped[str] = mapped_column(String(length))
first_name: Mapped[str] = mapped_column(String(length), nullable=True)
last_name: Mapped[str] = mapped_column(String(length), nullable=True)
username: Mapped[str] = mapped_column(String(length), nullable=True)
phone_number: Mapped[str] = mapped_column(String(length), nullable=True)
bio_msg: Mapped[str] = mapped_column(String(length), nullable=True)
profile_photo_id: Mapped[str] = mapped_column(String(length), nullable=True)
Expand Down
1 change: 1 addition & 0 deletions identity_socializer/web/api/auth/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class UserModelDTO(BaseModel):
email: str
first_name: Optional[str]
last_name: Optional[str]
username: Optional[str]
phone_number: Optional[str]
bio_msg: Optional[str]
profile_photo_id: Optional[str]
Expand Down
1 change: 1 addition & 0 deletions identity_socializer/web/api/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ async def update_user(
uid=user.id,
first_name=user.first_name,
last_name=user.last_name,
username=user.username,
phone_number=user.phone_number,
bio_msg=user.bio_msg,
profile_photo_id=user.profile_photo_id,
Expand Down

0 comments on commit 73b8c91

Please sign in to comment.