From 93268eaf619878ac7ab81d0f52e0fb33f6cb83c8 Mon Sep 17 00:00:00 2001 From: Federico Pacheco Date: Tue, 12 Mar 2024 00:35:57 -0300 Subject: [PATCH] Fix lint --- app/models/users.py | 5 +++-- app/repository/Users.py | 27 ++++++++++++++++----------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/app/models/users.py b/app/models/users.py index b89e1b4..a32ed6b 100644 --- a/app/models/users.py +++ b/app/models/users.py @@ -5,8 +5,9 @@ class User(Base): __tablename__ = "users" - __table_args__ = {'schema': \ - environ.get("POSTGRES_SCHEMA", "users_service")} + __table_args__ = {"schema": environ.get( + "POSTGRES_SCHEMA", + "users_service")} id = Column(Integer, primary_key=True, index=True, autoincrement=True) name = Column(String, nullable=True) email = Column(String, nullable=False) diff --git a/app/repository/Users.py b/app/repository/Users.py index 98526cf..5ff43d1 100644 --- a/app/repository/Users.py +++ b/app/repository/Users.py @@ -6,9 +6,11 @@ class UsersRepository: - db_url = environ.get("DATABASE_URL").replace("postgres://", - "postgresql://", - 1) + db_url = environ.get( + "DATABASE_URL").replace( + "postgres://", + "postgresql://", + 1) engine = create_engine(db_url) @@ -35,18 +37,21 @@ def get_all_users(self): users = self.session.query(User).all() return self.__parse_result(users) - def create_user(self, email: str, - name: Optional[str] = None, - gender: Optional[str] = None, - photo: Optional[str] = None): - user_data = {'email': email} + def create_user( + self, + email: str, + name: Optional[str] = None, + gender: Optional[str] = None, + photo: Optional[str] = None, + ): + user_data = {"email": email} if name is not None: - user_data['name'] = name + user_data["name"] = name if gender is not None: - user_data['gender'] = gender + user_data["gender"] = gender if photo is not None: - user_data['photo'] = photo + user_data["photo"] = photo new_user = User(**user_data) self.session.add(new_user)