Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Repeated files #59

Closed
Henriquelay opened this issue Jun 20, 2022 · 6 comments
Closed

Repeated files #59

Henriquelay opened this issue Jun 20, 2022 · 6 comments

Comments

@Henriquelay
Copy link
Collaborator

Henriquelay commented Jun 20, 2022

What is the difference between ResetUserPasswordService and UpdateUserService? Those files seems very much identical

@AtilioA
Copy link
Owner

AtilioA commented Jun 20, 2022

ResetUserPasswordService does not require the old password, unlike UpdateUserService. It also handles fewer of the user's attributes.

@Henriquelay
Copy link
Collaborator Author

Do you think it's sensible to treat in a single one for both operations, since both are UPDATING a field?

We check if newPassword is found and if it is, we treat as a password change aswell. Otherwise, regular attributes updating.
Can we bring field checking to the controller? Is it a good practice?

@AtilioA
Copy link
Owner

AtilioA commented Jun 20, 2022

Can we bring field checking to the controller? Is it a good practice?

I think it's up to the service to handle that.

In any case, we shouldn't be worrying about this :(

@Henriquelay
Copy link
Collaborator Author

Whatsapp
Can we transform this into a MVC best practices discussion then?
I do believe it's more about
Controller - Connection, input validation, technical means to accomplish thing
Service - do the thing, devoid of other types of validation, pure business logic.

@AtilioA
Copy link
Owner

AtilioA commented Jun 20, 2022

We aren't using an MVC architecture but sure
This discussion is similar to ours and the answers are especially relevant: https://stackoverflow.com/questions/46479889/validation-in-controller-or-service

@AtilioA AtilioA closed this as completed Jul 26, 2022
@AtilioA AtilioA closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2022
@AtilioA
Copy link
Owner

AtilioA commented Jul 26, 2022

😈

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants