fix(persistence): drop broken Guid lookup on ISnapshotRepository (CRITICAL)
Snapshots are append-only and identified by the composite (EventId, CapturedAt), not a surrogate Guid. The previous implementation inherited IRepository<Guid, OddsSnapshot> and faked the lookup with (long)key.GetHashCode() on a long auto-increment PK — collision-prone and non-portable. Nobody called GetAsync(Guid) / DeleteAsync(Guid) anyway. * ISnapshotRepository no longer extends IRepository<Guid, OddsSnapshot>; it exposes only the methods snapshots actually have: ListAsync, ListByEventAsync, AddAsync, SaveChangesAsync. * SnapshotRepository drops the broken Get/Update/Delete methods.
This commit is contained in:
@@ -6,11 +6,23 @@ namespace Marathon.Application.Abstractions;
|
||||
/// <summary>
|
||||
/// Repository for <see cref="OddsSnapshot"/> domain entities.
|
||||
/// </summary>
|
||||
public interface ISnapshotRepository : IRepository<Guid, OddsSnapshot>
|
||||
/// <remarks>
|
||||
/// Snapshots are append-only and identified by the composite (EventId, CapturedAt)
|
||||
/// rather than a surrogate key, so this contract intentionally does NOT extend
|
||||
/// <see cref="IRepository{TKey, TEntity}"/> — point lookup by Guid would be
|
||||
/// meaningless. Use <see cref="ListByEventAsync"/> for retrieval.
|
||||
/// </remarks>
|
||||
public interface ISnapshotRepository
|
||||
{
|
||||
Task<IReadOnlyList<OddsSnapshot>> ListAsync(CancellationToken ct = default);
|
||||
|
||||
Task<IReadOnlyList<OddsSnapshot>> ListByEventAsync(
|
||||
EventId eventId,
|
||||
DateTimeOffset from,
|
||||
DateTimeOffset to,
|
||||
CancellationToken ct = default);
|
||||
|
||||
Task AddAsync(OddsSnapshot entity, CancellationToken ct = default);
|
||||
|
||||
Task SaveChangesAsync(CancellationToken ct = default);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user