|
|
|
@ -1,32 +1,34 @@
|
|
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
|
using MediaBrowser.Model.Activity;
|
|
|
|
|
using MediaBrowser.Model.Events;
|
|
|
|
|
using MediaBrowser.Model.Querying;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
|
|
namespace Emby.Server.Implementations.Activity
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public class ActivityManager : IActivityManager
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public event EventHandler<GenericEventArgs<ActivityLogEntry>> EntryCreated;
|
|
|
|
|
|
|
|
|
|
private readonly IActivityRepository _repo;
|
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
|
private readonly IUserManager _userManager;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="ActivityManager"/> class.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="repo">The activity repository.</param>
|
|
|
|
|
/// <param name="userManager">The user manager.</param>
|
|
|
|
|
public ActivityManager(
|
|
|
|
|
ILoggerFactory loggerFactory,
|
|
|
|
|
IActivityRepository repo,
|
|
|
|
|
IUserManager userManager)
|
|
|
|
|
{
|
|
|
|
|
_logger = loggerFactory.CreateLogger(nameof(ActivityManager));
|
|
|
|
|
_repo = repo;
|
|
|
|
|
_userManager = userManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public void Create(ActivityLogEntry entry)
|
|
|
|
|
{
|
|
|
|
|
entry.Date = DateTime.UtcNow;
|
|
|
|
@ -36,6 +38,7 @@ namespace Emby.Server.Implementations.Activity
|
|
|
|
|
EntryCreated?.Invoke(this, new GenericEventArgs<ActivityLogEntry>(entry));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? hasUserId, int? startIndex, int? limit)
|
|
|
|
|
{
|
|
|
|
|
var result = _repo.GetActivityLogEntries(minDate, hasUserId, startIndex, limit);
|
|
|
|
@ -59,6 +62,7 @@ namespace Emby.Server.Implementations.Activity
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit)
|
|
|
|
|
{
|
|
|
|
|
return GetActivityLogEntries(minDate, null, startIndex, limit);
|
|
|
|
|