mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 21:13:28 -07:00
Fixed: History Since API endpoint
Closes #3198 Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
parent
d37b226fd4
commit
5ac1dace7f
1 changed files with 10 additions and 2 deletions
|
@ -117,14 +117,22 @@ namespace NzbDrone.Core.History
|
|||
|
||||
public List<EntityHistory> Since(DateTime date, EntityHistoryEventType? eventType)
|
||||
{
|
||||
var builder = Builder().Where<EntityHistory>(x => x.Date >= date);
|
||||
var builder = Builder()
|
||||
.Join<EntityHistory, Artist>((h, a) => h.ArtistId == a.Id)
|
||||
.Join<EntityHistory, Album>((h, a) => h.AlbumId == a.Id)
|
||||
.Where<EntityHistory>(x => x.Date >= date);
|
||||
|
||||
if (eventType.HasValue)
|
||||
{
|
||||
builder.Where<EntityHistory>(h => h.EventType == eventType);
|
||||
}
|
||||
|
||||
return Query(builder).OrderBy(h => h.Date).ToList();
|
||||
return _database.QueryJoined<EntityHistory, Artist, Album>(builder, (history, artist, album) =>
|
||||
{
|
||||
history.Artist = artist;
|
||||
history.Album = album;
|
||||
return history;
|
||||
}).OrderBy(h => h.Date).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue