Criar endpoint createPasswordReset
POST => /passwordReset
Acceptance Criteria:
- Receber post do front com a info em json do email do usuário
- Request GET => /users by email, retornar 400 caso nao encontre e pegar o user_id caso encontre
- Setar expiration_date como 30 minutos
- Gerar token
- Chamar o endpoint de envio de email da Loops.
- Retornar 200 caso sucesso
Req body:
{
email : string,
}
DB Model:
PasswordReset (
id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
user_id uuid NOT NULL,
token VARCHAR(255) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
expiration_date DATE NOT NULL
);
Chamada para API Loops (https://loops.so/docs/api-reference/send-transactional-email):
curl --request POST \
--url https://app.loops.so/api/v1/transactional \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"email": "<string>",
"transactionalId": "<string>",
"dataVariables": {}
}'