Order API
With the Product API in place, the next step is to implement the Order API. Orders are tied to authenticated users and reference existing products.
flowchart LR
subgraph api [Trusted Layer]
direction TB
gateway --> account
gateway --> auth
account --> db@{ shape: cyl, label: "Database" }
auth --> account
gateway e5@==> product
gateway e6@==> order:::red
product e2@==> db
order e3@==> db
order e4@==> product
end
internet e1@==>|request| gateway
e1@{ animate: true }
e2@{ animate: true }
e3@{ animate: true }
e4@{ animate: true }
e5@{ animate: true }
e6@{ animate: true }
classDef red fill:#fcc
click order "#order-api" "Order API" Attention
To consume the API, the user must be authenticated.
Order API
POST /order
Create a new order for the current user.
GET /order
Get all orders for the current user.
GET /order/{id}
Get the order details by its ID. The order must belong to the current user., otherwise, return a 404.
An optional query parameter currency allows the totals to be returned in a different currency. When omitted, values are returned in USD (the database storage currency).
Currency storage
All monetary values are stored in the database in US Dollars (USD). When a currency parameter is provided, the service must call the Exchange API to convert the totals before returning the response.
Additionals
Additional features are welcome, such as:
- Search products by "like" name;
- Authorization by role (admin, user):
- Admin can create, update, and delete products;
- User can only create orders;
- Input validations;
- Error handling.
Nice to have
- Observability (metrics, logs), see Prometheus and Grafana;
- Database In-Memory (suggestion: Product microservice), see Redis;
- Swagger documentation, see SpringDoc.
Entrega
Individualmente, cada aluno deve criar um repositório no GitHub, com a documentação em MkDocs dos exercícios realizados e também com o projeto e entrega o link via BlabkBoard. Na documentação publicada deve constar:
- Nome do aluno e grupo;
- Documentação das atividades realizadas;
- Código fonte das atividades realizadas;
- Documentação do projeto;
- Código fonte do projeto;
- Link para todos os repositórios utilizados;
- Destaques para os bottlenecks implementados (ao menos 2 por indivíduo);
- Apresentação do projeto;
- Vídeo de apresentação do projeto (2-3 minutos);
Um template de documentação pode ser encontrado em Template de Documentação.