Versiehistorie in een tabel, voor site en app
De versiehistorie stond als tekst in zowel de app als de website. Nu staat hij in tabel version_history, met een beheerpagina (Beheer > Versiehistorie) op de site. De site leest de tabel rechtstreeks, de app via de nieuwe actie app.versiehistorie. Startrijen: db/handmatig/22b_versiehistorie_startrijen.sql (als root). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014MGLqt1uKfNARQHut9ifcx
This commit is contained in:
@@ -267,6 +267,26 @@ public class VaultCategoryRepository : IVaultCategoryRepository
|
||||
public void Remove(VaultCategoryField veld) => _db.VaultCategoryFields.Remove(veld);
|
||||
}
|
||||
|
||||
/// <summary>De versiehistorie; zie <see cref="IVersiehistorieRepository"/>.</summary>
|
||||
public class VersiehistorieRepository : IVersiehistorieRepository
|
||||
{
|
||||
private readonly MijnBesluitDbContext _db;
|
||||
public VersiehistorieRepository(MijnBesluitDbContext db) => _db = db;
|
||||
|
||||
public async Task<IReadOnlyList<VersieRegel>> ListAsync(bool alleenZichtbaar, CancellationToken ct = default) =>
|
||||
await _db.VersieRegels.Where(r => !alleenZichtbaar || r.Zichtbaar)
|
||||
.OrderByDescending(r => r.Datum).ThenBy(r => r.Id).ToListAsync(ct);
|
||||
|
||||
public Task<VersieRegel?> FindAsync(int id, CancellationToken ct = default) =>
|
||||
_db.VersieRegels.FirstOrDefaultAsync(r => r.Id == id, ct);
|
||||
|
||||
public Task<bool> BestaatAsync(DateOnly datum, string kop, int? behalveId, CancellationToken ct = default) =>
|
||||
_db.VersieRegels.AnyAsync(r => r.Datum == datum && r.Kop == kop && (behalveId == null || r.Id != behalveId), ct);
|
||||
|
||||
public void Add(VersieRegel regel) => _db.VersieRegels.Add(regel);
|
||||
public void Remove(VersieRegel regel) => _db.VersieRegels.Remove(regel);
|
||||
}
|
||||
|
||||
public class VaultRepository : IVaultRepository
|
||||
{
|
||||
private readonly MijnBesluitDbContext _db;
|
||||
|
||||
Reference in New Issue
Block a user