You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1008 B
34 lines
1008 B
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using NzbDrone.Core.Datastore;
|
|
using NzbDrone.Core.Messaging.Events;
|
|
|
|
namespace NzbDrone.Core.Download.History
|
|
{
|
|
public interface IDownloadHistoryRepository : IBasicRepository<DownloadHistory>
|
|
{
|
|
List<DownloadHistory> FindByDownloadId(string downloadId);
|
|
void DeleteByAuthorId(int authorId);
|
|
}
|
|
|
|
public class DownloadHistoryRepository : BasicRepository<DownloadHistory>, IDownloadHistoryRepository
|
|
{
|
|
public DownloadHistoryRepository(IMainDatabase database, IEventAggregator eventAggregator)
|
|
: base(database, eventAggregator)
|
|
{
|
|
}
|
|
|
|
public List<DownloadHistory> FindByDownloadId(string downloadId)
|
|
{
|
|
return Query(h => h.DownloadId == downloadId)
|
|
.OrderByDescending(h => h.Date)
|
|
.ToList();
|
|
}
|
|
|
|
public void DeleteByAuthorId(int authorId)
|
|
{
|
|
Delete(r => r.AuthorId == authorId);
|
|
}
|
|
}
|
|
}
|