Move File; Move Route; use DateTime? in Query

This commit is contained in:
David 2020-06-10 13:09:23 +02:00
parent dc190e5683
commit 1bf6c085ed

View File

@ -7,12 +7,12 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Jellyfin.Api.Controllers.System namespace Jellyfin.Api.Controllers
{ {
/// <summary> /// <summary>
/// Activity log controller. /// Activity log controller.
/// </summary> /// </summary>
[Route("/System/ActivityLog/Entries")] [Route("/System/ActivityLog")]
[Authorize(Policy = Policies.RequiresElevation)] [Authorize(Policy = Policies.RequiresElevation)]
public class ActivityLogController : BaseJellyfinApiController public class ActivityLogController : BaseJellyfinApiController
{ {
@ -36,19 +36,15 @@ namespace Jellyfin.Api.Controllers.System
/// <param name="hasUserId">Optional. Only returns activities that have a user associated.</param> /// <param name="hasUserId">Optional. Only returns activities that have a user associated.</param>
/// <response code="200">Activity log returned.</response> /// <response code="200">Activity log returned.</response>
/// <returns>A <see cref="QueryResult{ActivityLogEntry}"/> containing the log entries.</returns> /// <returns>A <see cref="QueryResult{ActivityLogEntry}"/> containing the log entries.</returns>
[HttpGet] [HttpGet("Entries")]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult<QueryResult<ActivityLogEntry>> GetLogEntries( public ActionResult<QueryResult<ActivityLogEntry>> GetLogEntries(
[FromQuery] int? startIndex, [FromQuery] int? startIndex,
[FromQuery] int? limit, [FromQuery] int? limit,
[FromQuery] string minDate, [FromQuery] DateTime? minDate,
bool? hasUserId) bool? hasUserId)
{ {
DateTime? startDate = string.IsNullOrWhiteSpace(minDate) ? return _activityManager.GetActivityLogEntries(minDate, hasUserId, startIndex, limit);
(DateTime?)null :
DateTime.Parse(minDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
return _activityManager.GetActivityLogEntries(startDate, hasUserId, startIndex, limit);
} }
} }
} }