Overview
This gRPC endpoint follows Domain-Driven Design principles to retrieve a specific Basket aggregate root from the Orders bounded context by its user identifier. The operation is implemented as a query that doesn’t modify state, adhering to CQRS patterns.
The query handler maps the domain entity to a BasketDto response through an auto-mapper profile, ensuring that domain implementation details remain encapsulated. The endpoint respects the aggregate boundaries and only exposes data appropriate for the presentation layer.
Architecture
Usage
Call GetBasket using grpcurl
You can use grpcurl to call the GetBasket
method of the BasketGrpcService
defined in your basket.proto
:
grpcurl -plaintext \ -d '{}' \ -H "Authorization: Bearer <token>" \ localhost:5001 \ BasketApi.BasketGrpcService/GetBasket
- This endpoint does not require any request fields (uses
google.protobuf.Empty
). - Adjust the host/port (
localhost:5001
) as needed for your environment. - The response will be a
BasketResponse
message as defined in your proto:
{ "id": "...", "items": [ { "id": "...", "quantity": 2 }, // ... more items ... ]}
- The
Authorization
header is used to pass the JWT token for user authentication. Replace<token>
with a valid JWT token.
Basket ID