✨ feat(api/auth): multi-provider new template#48
Open
ChristianSanchez25 wants to merge 8 commits intofeat/new-templatefrom
Open
✨ feat(api/auth): multi-provider new template#48ChristianSanchez25 wants to merge 8 commits intofeat/new-templatefrom
ChristianSanchez25 wants to merge 8 commits intofeat/new-templatefrom
Conversation
…straction and an in-memory user repository for development.
…ed sign-in and sign-up.
…cing previous direct sign-in/sign-up logic.
…ith dedicated sign-in and sign-up use cases.
…p functionalities.
…sign-up use cases, new types, and updated module configuration.
…including tests, path aliases, and environment configuration.
Comment on lines
+7
to
+9
| password: z.string().min(8), | ||
| firstName: z.string().min(1), | ||
| lastName: z.string().min(1), |
There was a problem hiding this comment.
Bug: The sign-up request schema in SignUpWithProviderRequest.ts incorrectly requires firstName and lastName, causing validation errors for users who omit them, even though the system is designed to allow it.
Severity: HIGH
Suggested Fix
In SignUpWithProviderRequest.ts, update the Zod schema for firstName and lastName. Replace the .min(1) validation with .optional() to correctly mark these fields as optional, aligning the API contract with the backend logic and frontend schemas which are designed to handle their absence.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location:
apps/api/src/modules/auth/infrastructure/web/dto/SignUpWithProviderRequest.ts#L7-L9
Potential issue: The Zod schema in `SignUpWithProviderRequest.ts` incorrectly requires
`firstName` and `lastName` to be non-empty strings by using `.min(1)`. This contradicts
the intended design where these fields are optional, as evidenced by the
`CreateUserCommand` which accepts them as optional, the `CreateUserService` which
handles null values, and frontend schemas where they are marked as `.optional()`. This
discrepancy will cause the API to return a 400 Bad Request error for users who attempt
to sign up without providing a first or last name, blocking a valid user flow.
Did we get this right? 👍 / 👎 to inform future reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Descripción
Este PR implementa un sistema de autenticación configurable basado en proveedores (Providers), siguiendo los lineamientos de la Arquitectura Hexagonal. Separa la lógica de autenticación en casos de uso dedicados para Sign In y Sign Up, e incluye el refactor necesario para corregir violaciones a la regla de dependencias entre capas, además de implementar pruebas unitarias completas.
🚀 Cambios Principales
AuthProviderPort,AuthProviderFactoryPort) e implementaciones (CredentialsAuthProvider,AuthProviderFactoryImpl) para resolver dinámicamente los distintos proveedores de autenticación..env.example) para los secretos de autenticación e integración limpia de alias de rutas en eltsconfig.json.sign-in.test.ts).users.test.ts).getProviderTyperequerida porAuthProviderPort) y errores de sintaxis en Jest/Vitest.🧪 Cómo probar
npm install..envtomando como base el.env.example.npm run dev.