Follow this guide to implement a Delete Operation (Soft Delete) in the ApiService.
- •
Define the Domain Event
- •Create a
recordinsrc/BookStore.ApiService/Events/ - •Naming:
{Resource}Deleted - •Template:
templates/Event.cs
- •Create a
- •
Define the Command
- •Create a
recordinsrc/BookStore.ApiService/Commands/{Resource}/ - •Naming:
Delete{Resource} - •Template:
templates/Command.cs
- •Create a
- •
Implement the Endpoint
- •Create/Update
src/BookStore.ApiService/Endpoints/{Resource}Endpoints.cs - •Pattern: Wolverine.HTTP
- •Features: Use
[Aggregate]attribute to auto-load state. - •Logic: Pure function receiving
aggregateand returning(IResult, IEvent). - •Template:
templates/Endpoint.cs
- •Create/Update
- •
Update Read Models
- •Ensure your projections handle the
{Resource}Deletedevent (e.g., setDeleted = trueor remove document).
- •Ensure your projections handle the
Related Skills
- •
/scaffold-create-operation: For creating new resources. - •
/scaffold-update-operation: For updating existing resources.