Skip to content

Commit

Permalink
Feature/profile interest
Browse files Browse the repository at this point in the history
Co-authored-by: Luis Cusihuaman <[email protected]>
  • Loading branch information
noxethiems and LuisCusihuaman authored Dec 6, 2023
1 parent 3008284 commit fa380b8
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ jobs:
IDENTITY_SOCIALIZER_DB_HOST: localhost
devflow:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- name: checkout
uses: actions/checkout@master
Expand Down
2 changes: 2 additions & 0 deletions identity_socializer/db/dao/user_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ async def update_user_model(
bio_msg: Optional[str] = None,
profile_photo_id: Optional[str] = None,
ubication: Optional[str] = None,
interests: Optional[List[str]] = None,
) -> None:

"""Update single user to session."""
Expand All @@ -69,6 +70,7 @@ async def update_user_model(
bio_msg=bio_msg,
profile_photo_id=profile_photo_id,
ubication=ubication,
interests=interests,
)
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""add interests in users
Revision ID: d98bc4f14185
Revises: e4141c4c1350
Create Date: 2023-12-06 01:14:15.002499
"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "d98bc4f14185"
down_revision = "e4141c4c1350"
branch_labels = None
depends_on = None


def upgrade() -> None:
op.add_column("users", sa.Column("interests", sa.ARRAY(sa.String()), nullable=True))


def downgrade() -> None:
op.drop_column("users", "interests")
3 changes: 3 additions & 0 deletions identity_socializer/db/models/user_model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import datetime
from typing import List

from sqlalchemy.dialects.postgresql import ARRAY
from sqlalchemy.orm import Mapped, mapped_column
from sqlalchemy.sql.sqltypes import Boolean, DateTime, String

Expand Down Expand Up @@ -29,3 +31,4 @@ class UserModel(Base):
default=datetime.datetime.utcnow,
nullable=False,
)
interests: Mapped[List[str]] = mapped_column(ARRAY(String), nullable=True)
1 change: 1 addition & 0 deletions identity_socializer/tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ async def test_update_user(
"bio_msg": "bio_msg_test",
"profile_photo_id": "profile_photo_id_test",
"ubication": "Argentina",
"interests": ["some interest"],
},
)

Expand Down
4 changes: 3 additions & 1 deletion identity_socializer/web/api/auth/schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional
from typing import List, Optional

from pydantic import BaseModel, ConfigDict

Expand All @@ -14,6 +14,7 @@ class UserModelDTO(BaseModel):
bio_msg: Optional[str]
profile_photo_id: Optional[str]
ubication: Optional[str]
interests: Optional[List[str]]
model_config = ConfigDict(from_attributes=True)


Expand Down Expand Up @@ -49,4 +50,5 @@ class AppUserModel(BaseModel):
is_followed_back: Optional[bool] = False
blocked: bool = False
certified: bool = False
interests: Optional[List[str]]
model_config = ConfigDict(from_attributes=True)
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 @@ -45,6 +45,7 @@ async def update_user(
bio_msg=user.bio_msg,
profile_photo_id=user.profile_photo_id,
ubication=user.ubication,
interests=user.interests,
)


Expand Down
1 change: 1 addition & 0 deletions identity_socializer/web/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ async def complete_user(
is_followed_back=is_followed_back,
blocked=user.blocked,
certified=user.certified,
interests=user.interests,
)

0 comments on commit fa380b8

Please sign in to comment.