Skip to content

yraffic02/recicle-mais-back

Repository files navigation

Recicle Mais - Back-End💻

nest typescript NodeJS JWT Prisma

Getting StartedAPI EndpointsCollaboratorsContribute

Recicle mais is a recycling flow control app that allows, with practicality, agile communication between a recycler and a collector so that the materials to be recycled reach the collection point.

Cloning

How to clone your project

git clone git@github.com:yraffic02/recicle-mais-back.git

Install

npm install
npx prisma generate
npx prisma migrate dev --name init
npx prisma migrate dev

Prerequisites

  • [NodeJS]
  • [Nest]
  • [JWT]
  • [bcrypt]
  • [Prisma]
  • [Cors]
  • [Swagger]

🚀 Getting started

How to start the back-end project

npm run start:dev

📍 API Endpoints

Here has the list of the main routes until now, and what are their expected request bodies. ​

ROUTES DESCRIPTION
POST /user register user
POST /login user login
POST /user/profile show logged user
PUT /update-user update user
PUT/reset-pass reset user password
DELETE /delete-user delete selected user

POST /user

To register user, example :

BODY REQUEST

{
  "fullname": "Carlos Caldeira",
  "password": "123456",
  "email": "carloscaldeira@gmail.com",
  "phone": "71933333333",
  "user_type": "coletor",
  "address":  "Rua Canario, nº 12",
  "city": "São Paulo",
  "state": "SP",
  "zip_code": "04444-444",
  "user_type": "cliente",
  "avatar": "url/imagem"
}

RESPONSE

{
  "id": 2,
  "fullname": "Carlos Caldeira",
  "password": "$2b$10$0vYiRJL73/tBV2CStfGXz.sPvd2zHXBM8LIqnLNgZGexZm4u48vUq",
  "email": "carloscaldeira@gmail.com",
  "phone": "71933333333",
  "user_type": "coletor",
  "address":  "Rua Canario, nº 12",
  "city": "São Paulo",
  "state": "SP",
  "zip_code": "04444-444",
  "user_type": "cliente",
  "avatar": "url/imagem"
}

POST /login

To log in and receive an authentication token, example:

BODY REQUEST

{
  "email": "carloscaldeira@gmail.com",
  "password": "123456"
}

RESPONSE

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjEsImlhdCI6MTcxMDE2MzE5NCwiZXhwIjoxNzEwMjQ5NTk0fQ.mq9vh35k_P_4GTO--Pi2hVkH1ipraFN6rIhVvbblEKE"
}

GET /user/profile

To show the logged in user profile.

RESPONSE

  "id": 2,
  "fullname": "Carlos Caldeira",
  "password": "$2b$10$0vYiRJL73/tBV2CStfGXz.sPvd2zHXBM8LIqnLNgZGexZm4u48vUq",
  "email": "carloscaldeira@gmail.com",
  "phone": "71933333333",
  "user_type": "coletor",
  "address":  "Rua Canario, nº 12",
  "city": "São Paulo",
  "state": "SP",
  "zip_code": "04444-444",
  "user_type": "cliente",
  "avatar": "url/imagem"

POST /update-user

To edit user information. Protected route the user must be logged in. Example:

BODY REQUEST

{
  "fullname": "Carlos Caldeira",
  "password": "123456",
  "email": "carloscaldeira@gmail.com",
  "phone": "71933333333",
  "user_type": "coletor",
  "address":  "Rua Canario, nº 12",
  "city": "São Paulo",
  "state": "SP",
  "zip_code": "04444-444",
  "user_type": "coletor",
  "avatar": "url/imagem"
}

RESPONSE

{
 "message": "Dados atualizados com sucesso"
}

POST /reset-pass

To request password reset. Protected route the user must be logged in. Example:

BODY REQUEST

{
  "email": "carloscaldeira@gmail.com",
}

RESPONSE

{
  "message": "Um e-mail com a nova senha foi enviado."
}

DELETE /delete-user

To delete user logged. Protected route the user must be logged in. .

RESPONSE

Usuário removido com sucesso.

🤝 Developores

Back-end developers

Glaucia Castro

Isabel Diana

Eduardo L. Nunes

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •