Slide 18
Slide 18 text
18 VictorRentea.ro
a training by
InventoryItemDto
{
"id": 13,
"name": "Chair",
"supplierName": "ACME",
"supplierId": 78,
"description": "Soft friend",
"stock": 10,
"status": "ACTIVE",
"deactivationReason": null,
"creationDate": "2021-10-01",
"createdBy": "Wonder Woman"
}
CQRS
Dedicated Request/Response Dtos
= CQRS at the API Level
CreateItemRequest
{
"name": "Chair",
"supplierId": 78,
"description": "Soft friend",
"stock": 10
}
GetItemResponse
{
"id": 13,
"name": "Chair",
"supplierName": "ACME",
"supplierId": 78,
"description": "Soft friend",
"stock": 10,
"status": "ACTIVE",
"deactivationReason": null,
"creationDate": "2021-10-01",
"createdBy": "Wonder Woman"
}
@GetMapping("{id}")
GetItemResponse get(id) {
@PostMapping
void create(CreateItemRequest){
@NotNull
in dto
package