Reformat all code as per my preferred formatting.

This commit is contained in:
2026-07-17 17:14:44 +02:00
parent 29d179a23a
commit 249a166d07
13 changed files with 181 additions and 169 deletions
@@ -14,22 +14,30 @@ public class AccountDbContext(DbContextOptions<AccountDbContext> options) : DbCo
modelBuilder.Entity<Account>()
.HasKey(x => x.Id);
modelBuilder.Entity<Account>().HasData(
new Account(1, 10000000.00m, "Credit"),
new Account(2, 50000000.00m, "Liability"),
new Account(99999, 0.00m, "Revenue")
);
modelBuilder.Entity<Account>()
.HasData(
new Account(1, 10000000.00m, "Credit"),
new Account(2, 50000000.00m, "Liability"),
new Account(99999, 0.00m, "Revenue")
);
modelBuilder.Entity<JournalEntry>(builder =>
{
builder.HasKey(x => x.Id);
builder.OwnsMany(x => x.Lines, line =>
{
line.WithOwner().HasForeignKey("JournalEntryId");
line.Property<int>("Id").ValueGeneratedOnAdd();
line.HasKey("Id");
line.Property(x => x.Type).HasConversion<string>();
});
});
builder.HasKey(x => x.Id);
builder.OwnsMany(
x => x.Lines,
line =>
{
line.WithOwner()
.HasForeignKey("JournalEntryId");
line.Property<int>("Id")
.ValueGeneratedOnAdd();
line.HasKey("Id");
line.Property(x => x.Type)
.HasConversion<string>();
}
);
}
);
}
}
@@ -10,8 +10,7 @@ public class ReversalQuery(AccountDbContext db, TimeProvider timeProvider) : IRe
{
public async Task<JournalReversalContext?> GetReversalDataAsync(Guid journalEntryId)
{
var entry = await db.JournalEntries
.Include(x => x.Lines)
var entry = await db.JournalEntries.Include(x => x.Lines)
.AsNoTracking()
.FirstOrDefaultAsync(x => x.Id == journalEntryId);
@@ -20,10 +19,11 @@ public class ReversalQuery(AccountDbContext db, TimeProvider timeProvider) : IRe
return null;
}
var accountIds = entry.Lines.Select(l => l.AccountId).Distinct().ToList();
var accountIds = entry.Lines.Select(l => l.AccountId)
.Distinct()
.ToList();
var accounts = await db.Accounts
.AsNoTracking()
var accounts = await db.Accounts.AsNoTracking()
.Where(a => accountIds.Contains(a.Id))
.ToListAsync();