/vendas-springboot-jpa

I developed this project in the UDEMY course "Spring Boot Expert: JPA, RESTFul API, Security, JWT e Mais" that has been taught by professor Dougllas Sousa.

Primary LanguageJava

🚀 Vendas Application 🚀

I developed this project in the UDEMY course "Spring Boot Expert: JPA, RESTFul API, Security, JWT e Mais" that has been taught by professor Dougllas Sousa.

In this project you can create a new user and authenticated it. The endpoints of customers(clientes), products(produtos) and orders(pedidos) only worked if the user is authenticated and use the token. There are two roles in the application: ADMIN and USER. The user with role ADMIN can do everything in the system. The role USER can only manipulate the customers and orders endpoints.

In addition to the subjects I have studied in this course, I decided to create unit tests with JUnit and Mockito to increment the project.

You can use the Swagger to manipulate the endpoints: http://localhost:8080/swagger-ui.html

🚀 Technologies

It was used these technologies in this project.

💻 How to run the application

Pre Requiriments

You will need these tools instaled in your machine:

  • Must have Git installed
  • At least have Java 8 installed
  • Must have Maven installed
# Clone this repository
git clone https://github.com/yesminmarie/vendas-springboot-jpa

# Go into the folder of the project
cd vendas-springboot-jpa

# execute the project
./mvn spring-boot:run

Endpoints:

Usuarios:

  • POST - localhost:8080/api/usuarios (Save a new user)

Example:

{
  "admin": true,
  "login": "maria",
  "senha": "teste123"
}
  • POST - localhost:8080/api/usuarios/auth (Authenticate a user)

Example:

{
  "login": "maria",
  "senha": "teste123"
}

Clientes:

  • GET - localhost:8080/api/clientes/{id} (Gets details of a specific customer)

  • GET - localhost:8080/api/clientes (Filter by any property)

Example: http://localhost:8080/api/clientes?cpf=123&nome=maria

  • POST - localhost:8080/api/clientes (Save a new customer)

Example:

{
  "cpf": "94666871071",
  "nome": "Maria"
}
  • PUT - localhost:8080/api/clientes/{id} (update a specific customer)

Example:

{
  "cpf": "94666871071",
  "nome": "Maria"
}
  • DELETE - localhost:8080/api/clientes/{id} (Delete a customer by id)

Produtos:

  • GET - localhost:8080/api/produtos/{id} (Get details for a specific product)

  • GET - localhost:8080/api/produtos (Filter by any property)

Example: http://localhost:8080/api/produtos?descricao=mouse&preco=25

  • POST - localhost:8080/api/produtos (Save a new product)

Example:

{
  "descricao": "Mouse",
  "preco": 40.00
}
  • PUT - localhost:8080/api/produtos/{id} (update a specific product)

Example:

{
  "descricao": "Mouse",
  "preco": 40.00
}
  • DELETE - localhost:8080/api/{id} (Delete a product by id)

Pedidos:

  • GET - localhost:8080/api/pedidos/{id} (Gets details of a specific order)

  • PATCH - localhost:8080/api/pedidos/{id} (Update order status)

Example:

{
  "novoStatus": "CANCELADO"
}
  • POST - localhost:8080/api/pedidos (Save a new order)

Example:

{
  "cliente": 1,
  "itens": [
    {
      "produto": 1,
      "quantidade": 5
    }
  ],
  "total": 100
}

Made with ❤️ by Yesmin Marie