Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
jonra1993 committed Feb 23, 2024
2 parents 2a9bd83 + e24e62a commit a5064b3
Show file tree
Hide file tree
Showing 7 changed files with 1,559 additions and 1,415 deletions.
4 changes: 2 additions & 2 deletions backend/app/app/api/v1/endpoints/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def export_users_list(
"""
users = await crud.user.get_multi_ordered(limit=1000, order_by="id")
users_list = [
IUserRead.from_orm(user) for user in users
IUserRead.model_validate(user) for user in users
] # Creates a pydantic list of object
users_df = pd.DataFrame([s.__dict__ for s in users_list])
if file_extension == FileExtensionEnum.xls:
Expand Down Expand Up @@ -88,7 +88,7 @@ async def export_heroes_list(
"""
heroes = await crud.hero.get_multi_ordered(limit=1000, order_by="id")
heroes_list = [
IHeroRead.from_orm(hero) for hero in heroes
IHeroRead.model_validate(hero) for hero in heroes
] # Creates a pydantic list of object
heroes_df = pd.DataFrame([s.__dict__ for s in heroes_list])
if file_extension == FileExtensionEnum.xls:
Expand Down
3 changes: 1 addition & 2 deletions backend/app/app/crud/base_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ async def get_multi_paginated(
query = select(self.model)

output = await paginate(db_session, query, params)
print("output", output)
return output

async def get_multi_paginated_ordered(
Expand Down Expand Up @@ -156,7 +155,7 @@ async def create(
db_session: AsyncSession | None = None,
) -> ModelType:
db_session = db_session or self.db.session
db_obj = self.model.from_orm(obj_in) # type: ignore
db_obj = self.model.model_validate(obj_in) # type: ignore

if created_by_id:
db_obj.created_by_id = created_by_id
Expand Down
4 changes: 2 additions & 2 deletions backend/app/app/crud/user_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def create_with_role(
self, *, obj_in: IUserCreate, db_session: AsyncSession | None = None
) -> User:
db_session = db_session or super().get_db().session
db_obj = User.from_orm(obj_in)
db_obj = User.model_validate(obj_in)
db_obj.hashed_password = get_password_hash(obj_in.password)
db_session.add(db_obj)
await db_session.commit()
Expand Down Expand Up @@ -73,7 +73,7 @@ async def update_photo(
) -> User:
db_session = super().get_db().session
user.image = ImageMedia(
media=Media.from_orm(image),
media=Media.model_validate(image),
height=heigth,
width=width,
file_format=file_format,
Expand Down
2 changes: 1 addition & 1 deletion backend/app/app/crud/user_follow_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def follow_a_user_by_target_user_id(
new_user_follow = IUserFollowCreate(
user_id=user.id, target_user_id=target_user.id
)
db_obj = UserFollowModel.from_orm(new_user_follow)
db_obj = UserFollowModel.model_validate(new_user_follow)

reverse_follow = await self.get_follow_by_user_id_and_target_user_id(
user_id=target_user.id, target_user_id=user.id
Expand Down
2 changes: 1 addition & 1 deletion backend/app/app/utils/map_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@


def map_models_schema(schema: SchemaType, models: list[ModelType]):
return [schema.from_orm(model) for model in models]
return [schema.model_validate(model) for model in models]
2,953 changes: 1,549 additions & 1,404 deletions backend/app/poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions backend/app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ exclude = ["alembic", "__pycache__"]
python = ">3.9,<3.12"
alembic = "^1.13.0"
asyncpg = "^0.29.0"
fastapi = {extras = ["all"], version = "^0.104.1"}
sqlmodel = "^0.0.14"
fastapi = {extras = ["all"], version = "^0.109.2"}
sqlmodel = "0.0.16"
cryptography = "^41.0.7"
bcrypt = "^4.1.1"
SQLAlchemy-Utils = "^0.41.1"
Expand All @@ -53,7 +53,7 @@ fastapi-cache2 = "^0.2.1"
minio = "^7.2.0"
Pillow = "^10.1.0"
watchfiles = "^0.21.0"
asyncer = "^0.0.2"
asyncer = "0.0.5"
httpx = "^0.25.2"
pandas = "^2.1.4"
openpyxl = "^3.1.2"
Expand Down

0 comments on commit a5064b3

Please sign in to comment.