Skip to content

19 registro de usuario#20

Open
FeliPrado31 wants to merge 4 commits intomainfrom
19-registro-de-usuario
Open

19 registro de usuario#20
FeliPrado31 wants to merge 4 commits intomainfrom
19-registro-de-usuario

Conversation

@FeliPrado31
Copy link
Owner

@FeliPrado31 FeliPrado31 commented May 31, 2024

  • Endpoint: /api/register
  • Método: POST
  • Descripción: Registra un nuevo usuario en el sistema.
  • Request Body:
    {
      "userEmail": "user@example.com",
      "userPassword": "password123",
      "userName": "test"
    }
  • Respuesta Exitosa:
    {
      "idToken": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjFlOWdkazcifQ...",
      "refreshToken": "ABCXYZ123",
      "expiresIn": "3600"
    }
  • Respuesta de Error:
    {
      "error": {
        "code": 400,
        "message": "EMAIL_EXISTS",
        "errors": [
          {
            "message": "The email address is already in use by another account.",
            "domain": "global",
            "reason": "invalid"
          }
        ]
      }
    }

…erUseCase

This commit adds the following changes:
- Added a new file `User.ts` under `api/domain/entities` to define the User entity with properties like email, password, name, createdAt, and updatedAt.
- Created `AuthRepository.ts` under `api/domain/repositories` to handle authentication-related operations using Firebase Admin SDK.
- Implemented `UserRepository.ts` under `api/domain/repositories` to handle user-related operations using Firebase Admin SDK.
- Added `RegisterUserUseCase.ts` under `api/usecases` to handle the registration of a new user by saving the user to the database and creating a user record in Firebase Auth.

These changes are necessary to support user registration functionality in the application.
@FeliPrado31 FeliPrado31 linked an issue May 31, 2024 that may be closed by this pull request
3 tasks
The code changes in `RegisterUser.ts` improve the user registration process by first creating a user record in Firebase Auth and then saving the user to the database. This change ensures that the user is properly authenticated before saving their information. This refactor aligns with the recent changes made to the User entity, AuthRepository, UserRepository, and RegisterUserUseCase.
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.

Registro de Usuario

1 participant