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.
|
|
|
|
using MediaBrowser.Common.Events;
|
|
|
|
|
using MediaBrowser.Controller.Activity;
|
|
|
|
|
using MediaBrowser.Model.Activity;
|
|
|
|
|
using MediaBrowser.Model.Events;
|
|
|
|
|
using MediaBrowser.Model.Logging;
|
|
|
|
|
using MediaBrowser.Model.Querying;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Server.Implementations.Activity
|
|
|
|
|
{
|
|
|
|
|
public class ActivityManager : IActivityManager
|
|
|
|
|
{
|
|
|
|
|
public event EventHandler<GenericEventArgs<ActivityLogEntry>> EntryCreated;
|
|
|
|
|
|
|
|
|
|
private readonly IActivityRepository _repo;
|
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
|
|
|
|
|
|
public ActivityManager(ILogger logger, IActivityRepository repo)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
_repo = repo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task Create(ActivityLogEntry entry)
|
|
|
|
|
{
|
|
|
|
|
entry.Id = Guid.NewGuid().ToString("N");
|
|
|
|
|
entry.Date = DateTime.UtcNow;
|
|
|
|
|
|
|
|
|
|
await _repo.Create(entry).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
EventHelper.FireEventIfNotNull(EntryCreated, this, new GenericEventArgs<ActivityLogEntry>(entry), _logger);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public QueryResult<ActivityLogEntry> GetActivityLogEntries(int? startIndex, int? limit)
|
|
|
|
|
{
|
|
|
|
|
return _repo.GetActivityLogEntries(startIndex, limit);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|