Co-authored-by: Zeoic <zeorgaming@gmail.com>
Co-authored-by: Fesaa <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
Joe Milazzo 2025-03-01 17:17:57 -06:00 committed by GitHub
parent b38400c092
commit 0ffe0228e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 339 additions and 115 deletions

View file

@ -19,11 +19,13 @@ public interface IScrobbleRepository
void Attach(ScrobbleError error);
void Remove(ScrobbleEvent evt);
void Remove(IEnumerable<ScrobbleEvent> events);
void Remove(IEnumerable<ScrobbleError> errors);
void Update(ScrobbleEvent evt);
Task<IList<ScrobbleEvent>> GetByEvent(ScrobbleEventType type, bool isProcessed = false);
Task<IList<ScrobbleEvent>> GetProcessedEvents(int daysAgo);
Task<bool> Exists(int userId, int seriesId, ScrobbleEventType eventType);
Task<IEnumerable<ScrobbleErrorDto>> GetScrobbleErrors();
Task<IList<ScrobbleError>> GetAllScrobbleErrorsForSeries(int seriesId);
Task ClearScrobbleErrors();
Task<bool> HasErrorForSeries(int seriesId);
Task<ScrobbleEvent?> GetEvent(int userId, int seriesId, ScrobbleEventType eventType);
@ -66,6 +68,11 @@ public class ScrobbleRepository : IScrobbleRepository
_context.ScrobbleEvent.RemoveRange(events);
}
public void Remove(IEnumerable<ScrobbleError> errors)
{
_context.ScrobbleError.RemoveRange(errors);
}
public void Update(ScrobbleEvent evt)
{
_context.Entry(evt).State = EntityState.Modified;
@ -113,6 +120,13 @@ public class ScrobbleRepository : IScrobbleRepository
.ToListAsync();
}
public async Task<IList<ScrobbleError>> GetAllScrobbleErrorsForSeries(int seriesId)
{
return await _context.ScrobbleError
.Where(e => e.SeriesId == seriesId)
.ToListAsync();
}
public async Task ClearScrobbleErrors()
{
_context.ScrobbleError.RemoveRange(_context.ScrobbleError);
@ -161,4 +175,5 @@ public class ScrobbleRepository : IScrobbleRepository
return await _context.ScrobbleEvent.Where(e => e.SeriesId == seriesId)
.ToListAsync();
}
}