Skip to content

User entitie#1

Open
PedroOSanches wants to merge 9 commits into
devfrom
user-entitie
Open

User entitie#1
PedroOSanches wants to merge 9 commits into
devfrom
user-entitie

Conversation

@PedroOSanches

Copy link
Copy Markdown

No description provided.

@lseixas lseixas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PedroOSanches reverte as alterações que você fez nas rotas, não vamos usa-las do jeito que estão agora

Deixa alterações apenas nos arquivos: user.py, test_user.py, user_repo_mock.py, test_user_repo_mock.py, user_repository_interface.py

Comment on lines 9 to 11
class UserRepositoryMock(IUserRepository):
users: List[User]
user_counter: int

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pode remover esse user counter, inclusive a função dele no mock também

A interface IUserRepository não está aparecendo aqui no diff, provavelmente ta com a assinatura antiga dos métodos.

Comment on lines +20 to +24
def get_user(self, user_email: str) -> User:
for user in self.users:
if user.user_id == user_id:
if user.email == user_email:
return user
raise NoItemsFound("user_id")
raise NoItemsFound("user_email")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Troca o get_user para pedir um id e buscar no banco por um id ao invés de email

Comment on lines +34 to 38
def delete_user(self, user_email: str) -> User:
for idx, user in enumerate(self.users):
if user.user_id == user_id:
if user.email == user_email:
self.user_counter -= 1
return self.users.pop(idx)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mesma coisa aqui, coloca para puxar por id

Comment on lines +42 to 46
def update_user(self, user_email: str, new_password_hash: str) -> User:
for user in self.users:
if user.user_id == user_id:
user.name = new_name
if user.email == user_email:
user.password_hash = new_password_hash
return user

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aqui também. Outra coisa, adiciona aqui a opção do método alterar a Role do usuário também

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dentro desse arquivo, troca os raise NoItemsFound para um return None.

Comment thread requirements-dev.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverte esse requirements para o que estava antes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants