Skip to content

Commit

Permalink
refactor(users_db): remove user_schema instance and use UserSchema di…
Browse files Browse the repository at this point in the history
…rectly in get_users
  • Loading branch information
fcoagz committed Nov 25, 2024
1 parent 0f1644a commit 38f0838
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/data/services/users_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from ..models import User
from ..schemas import UserSchema

user_schema = UserSchema()

def is_user_valid(session: Session, token: str) -> bool:
user = session.query(User).filter(User.token == token).first()
if not user:
Expand All @@ -31,4 +29,4 @@ def delete_user(session: Session, id: int) -> None:

def get_users(session: Session) -> list:
models = session.query(User).all()
return user_schema.dump(models, many=True)
return UserSchema().dump(models, many=True)

0 comments on commit 38f0838

Please sign in to comment.