Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(UserService): Cambios en user endpoints and more #148

Merged
merged 4 commits into from
Oct 15, 2023

Conversation

Mr-T-Smyth
Copy link
Collaborator

What && Why

  • Se cambian los endpoints y se borra el middleware de user
  • Se arregla el error de regex en signup que aparecia en la consola cuando escribias un mail

Links

 - Se cambian los endpoints y se borra el middleware de user
 - Se arregla el error de regex en signup
@@ -114,7 +111,6 @@ export default function Form() {
type='email'
id='email'
name='email'
pattern={mustBeMailAdress()}
Copy link
Collaborator

@santimintegui santimintegui Oct 14, 2023

Choose a reason for hiding this comment

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

porque se elimina el pattern aca? tenia entendido que queremos chequearlo pero con un pattern que no de error en consola que creo que es posible ( aunque no sea identico al del back )

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Porque no logre hace rque ande ningun otro, simpre tirarn error de syntaxis( que es lo que pasaba antes) y en realidad el mustBeMailAdress() no funcionaba tampoco y estaba corriendo solo el de type=email. Hice un poco de reaserch y el patter por defecto no esta tan mal y si no tenemos que controlar que sean mails se de la fing estamos bien con el de type


export class UserService {
public static async getUser(id: string): Promise<User> {
return (await ApiCommunicator.getUser(id)) as User;
////////////// AUTHENTICATION ////////////////////////
Copy link
Collaborator

Choose a reason for hiding this comment

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

es necesario este comentario? con los nombres de la funciones creo que queda claro que es de autenticacion

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, tenes razon, ya lo cambio a algo mas prolijo

Comment on lines 7 to 13
static api() {
return process.env.NEXT_PUBLIC_RAILS_API_URL;
}

static apiUrl() {
const RAILS_API_URL = process.env.RAILS_API_URL;

Copy link
Collaborator

Choose a reason for hiding this comment

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

Como se diferencian estas dos variables de enotrno?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

en contenido? Nada, pero me daba terrible pereza poner el env en todos lados entonces lo puse en un metodo distinto ( todavia precismaos el otro metodo para no romper el resto)


////////////////////////////////////////////////////////

public static async getUser(session: Session): Promise<User> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

En otros PRs estamos siguiendo el patron de pasar los datos y el token en vez de toda la sesion. Deberiamos ser consistentes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree

| {
password: string;
}
): Promise<Response> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Creo que preferiria que esto me devuelva lo que es y no un objecto Response asi pelado. Siento que me estan leakeando las abstracciones y se me mezclan las capas.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No entiendo, esta devolviendo lo que es, osea una response. En front preguntamos si esta bien y eso. Es horrible y esta linkeado con la idea de que se manejo como expetion todo y que no llegue como vos decis, pero esto queda para otro pr

Comment on lines +7 to +8
//Lo saco porque no es un regex valido y el type email ya funciona lo bastante bien en input
//no es perfecto pero no hay ningun regex que lo sea para mail
Copy link
Collaborator

Choose a reason for hiding this comment

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

Creo que este comentario iba en el input y no aca. Hay un comentario al respecto.

}

public static async modifyPassword(
id: string,
user: User,
currentPassword: string,
newPassword: string
): Promise<any> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lo mismo con los any, hay chances de devolver cosas de dominio aca?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Si, tenes razon en que ahora mismo deberia devolver Response

@Mr-T-Smyth Mr-T-Smyth requested review from Cocofredo and Frodo2412 and removed request for Cocofredo and marcegodoy October 14, 2023 20:13
Copy link
Collaborator

@Cocofredo Cocofredo left a comment

Choose a reason for hiding this comment

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

LGTM

@Mr-T-Smyth Mr-T-Smyth merged commit 561655c into develop Oct 15, 2023
1 check passed
@Mr-T-Smyth Mr-T-Smyth deleted the feat/cambiar-endpoints-users branch October 15, 2023 11:33
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.

4 participants