Conversation
new changes allows to create and get permissions
Modify the Auth interface contract to update the signature of the getPermissions method. Now it accepts only the userId parameter instead of (email, password) for more secure and efficient authentication handling. BREAKING CHANGE: The getPermissions method signature has been updated to accept only the userId parameter instead of (email, password).
Alan-TheGentleman
left a comment
There was a problem hiding this comment.
Me gustan las ideas que has querido implementar !
Solamente algunos comentarios para tener en cuenta. Y en cuanto a la implementación del userId, realmente el email ya debería de ser diferente ya que no debería de repetirse en la base de datos
| import { Permissions } from "../../app/schemas/auth"; | ||
| import { ForRepoQuerying } from "../../ports/drivens"; | ||
|
|
||
| export class RepoQuerierStubAdapter implements ForRepoQuerying { |
There was a problem hiding this comment.
Si es un stub no debería tener utilización real de los proxy u otros adapters. Debería de retornar un mock
There was a problem hiding this comment.
Creo que te has equivocado con el nombre del archivo y por eso sigue diciendo que es un stub, porque es una copia del RepoQuerierStubAdapter pero ha faltado modificar
| ) {} | ||
|
|
||
| async getAuthDetails(email: string, password: string): Promise<AuthDetails> { | ||
| const user = await this.repoQuerier.getUser(email); |
There was a problem hiding this comment.
realmente esta comprobacion de si existe el user o no, se podría hacer en el repoQuerier y esto englobarlo con un try catch, cosa que si entra por el catch envie el error
There was a problem hiding this comment.
tenés razón, ya lo corregí para que haga el catch del error.También vi que el logger era innecesario porque ya estaba en el repository asi que lo quité
| } | ||
|
|
||
| async getInternalUser(email: string): Promise<RepoUser> { | ||
| const user = this.userList.find((user) => user.email === email); |
There was a problem hiding this comment.
Agregar separación entre unidades lógicas
| const user = this.userList.find((user) => user.email === email); | |
| const user = this.userList.find((user) => user.email === email); | |
There was a problem hiding this comment.
no sabía muy como interpretar lo de la separación entre unidades lógicas, asumí que te referías a que en el repository estaba combinando consultas de permissions y user, puede que sea por ahí?
There was a problem hiding this comment.
Es solo el agregado de un espacio entre unidades. Aquí tienes un video como guía:
👨💻💻 Programando con estilo: cómo escribir código limpio y elegante como un verdadero 😎crack💪
https://youtu.be/041fWH35X-4
| permissions: Permissions | ||
| ): Promise<UserPermission> { | ||
| const newUserPermission: UserPermission = { | ||
| id: String(this.userList.length + 1), |
There was a problem hiding this comment.
Ojo con estos agregados utilizando la longitud, porque si eliminas un usuario diferente al ultimo y vuelves a agregar otro se repetiria el ultimo usuario en cuanto al id
Creo el pullrequest por motivos didácticos por si alguien está interesado en ver mi solución al reto de crear el control plane, por eso lo pongo todo en el mismo pullrequest.
La verdad apenas estoy aprendiendo de la arquitectura hexagonal y puede que tenga errores, sin embargo estoy abierto a correcciones.