Some fixes to the queries and context records.

This commit is contained in:
2026-07-30 08:17:18 +02:00
parent acc8423fc6
commit f8b37815b0
15 changed files with 255 additions and 29 deletions
@@ -1,14 +1,12 @@
using FinancialApi.Application.Commands;
using FinancialApi.Application.Handlers;
using FinancialApi.Application.Interfaces;
using FinancialApi.Application.Models;
using FinancialApi.Domain.Entities;
using Microsoft.EntityFrameworkCore;
namespace FinancialApi.Infrastructure;
public class ReversalQuery(AccountDbContext db, TimeProvider timeProvider) : IReversalQuery
public class ReversalQuery(AccountDbContext db) : IReversalQuery
{
public async Task<JournalReversalContext?> GetReversalDataAsync(Guid journalEntryId)
public async Task<(JournalEntry?, List<Account>?)> GetReversalDataAsync(Guid journalEntryId)
{
var entry = await db.JournalEntries.Include(x => x.Lines)
.AsNoTracking()
@@ -16,7 +14,7 @@ public class ReversalQuery(AccountDbContext db, TimeProvider timeProvider) : IRe
if (entry == null)
{
return null;
return (null, null);
}
var accountIds = entry.Lines.Select(l => l.AccountId)
@@ -27,6 +25,6 @@ public class ReversalQuery(AccountDbContext db, TimeProvider timeProvider) : IRe
.Where(a => accountIds.Contains(a.Id))
.ToListAsync();
return new JournalReversalContext(entry, accounts, timeProvider.GetUtcNow());
return (entry, accounts);
}
}