This is all very interesting, but what is the purpose that I would move into "FastEndpoints" vs. MediatR? Right now, ALL of our Controllers are 1 line of code each "action", meaning, there is absolutely no need to UnitTest a Controller, and the only thing the controller is there for is "decorating" the API for swagger. I could see other developers getting quickly confused why there is so much orchestration for setting up an API?
Example Controller action:
[HttpPost("transaction")] // /inventory/transaction
[Produces(System.Net.Mime.MediaTypeNames.Application.Json)]
[ProducesResponseType(StatusCodes.Status202Accepted)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task SaveInventoryTransaction(InventoryTransaction model)
=> await this.Execute(
new SaveInventoryTransactionEvent { Model = new InventoryTransaction[] { model } },
// Return 202, not 200 because 200 means we've processed it, whereas 202 means we've accepted it for processing later
res => this.Accepted()
);
This is all very interesting, but what is the purpose that I would move into "FastEndpoints" vs. MediatR? Right now, ALL of our Controllers are 1 line of code each "action", meaning, there is absolutely no need to UnitTest a Controller, and the only thing the controller is there for is "decorating" the API for swagger. I could see other developers getting quickly confused why there is so much orchestration for setting up an API?
Example Controller action:
[HttpPost("transaction")] // /inventory/transaction
[Produces(System.Net.Mime.MediaTypeNames.Application.Json)]
[ProducesResponseType(StatusCodes.Status202Accepted)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task SaveInventoryTransaction(InventoryTransaction model)
=> await this.Execute(
new SaveInventoryTransactionEvent { Model = new InventoryTransaction[] { model } },
// Return 202, not 200 because 200 means we've processed it, whereas 202 means we've accepted it for processing later
res => this.Accepted()
);
give this article a read: bradjolicoeur.com/Article/fast-end...