Creating a Journal Reversal handler.

This commit is contained in:
2026-07-15 17:29:02 +02:00
parent 0376b58a33
commit e109c1c695
7 changed files with 122 additions and 6 deletions
@@ -24,3 +24,13 @@ Content-Type: application/json
"destinationAccountId": 2,
"amount": 3000.00
}
### Reverse a Journal Entry
POST {{FinancialApi_HostAddress}}/journal/reverse
Content-Type: application/json
{
"originalJournalId": "AD4FC011-9979-4364-A0D4-2CCD922ECB5E",
"reason": "Incorrect Account"
}
@@ -21,6 +21,7 @@ builder.Services.AddDbContext<AccountDbContext>(options =>
options.UseSqlite(connectionString));
builder.Services.AddScoped<IAccountQuery, AccountQuery>();
builder.Services.AddScoped<IReversalQuery, ReversalQuery>();
// Add services to the container.
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
@@ -67,4 +68,10 @@ app.MapPost("/accounts/transfer", async (TransferFundsCommand cmd, IMessageBus b
return Results.Accepted();
});
app.MapPost("/journal/reverse", async (ReverseJournalCommand cmd, IMessageBus bus) =>
{
await bus.InvokeAsync(cmd);
return Results.Accepted();
});
app.Run();