|
|
|
@ -72,7 +72,7 @@ public class PlaystateController : BaseJellyfinApiController
|
|
|
|
|
[HttpPost("UserPlayedItems/{itemId}")]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult<UserItemDataDto>> MarkPlayedItem(
|
|
|
|
|
public async Task<ActionResult<UserItemDataDto?>> MarkPlayedItem(
|
|
|
|
|
[FromQuery] Guid? userId,
|
|
|
|
|
[FromRoute, Required] Guid itemId,
|
|
|
|
|
[FromQuery, ModelBinder(typeof(LegacyDateTimeModelBinder))] DateTime? datePlayed)
|
|
|
|
@ -121,7 +121,7 @@ public class PlaystateController : BaseJellyfinApiController
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
[Obsolete("Kept for backwards compatibility")]
|
|
|
|
|
[ApiExplorerSettings(IgnoreApi = true)]
|
|
|
|
|
public Task<ActionResult<UserItemDataDto>> MarkPlayedItemLegacy(
|
|
|
|
|
public Task<ActionResult<UserItemDataDto?>> MarkPlayedItemLegacy(
|
|
|
|
|
[FromRoute, Required] Guid userId,
|
|
|
|
|
[FromRoute, Required] Guid itemId,
|
|
|
|
|
[FromQuery, ModelBinder(typeof(LegacyDateTimeModelBinder))] DateTime? datePlayed)
|
|
|
|
@ -138,7 +138,7 @@ public class PlaystateController : BaseJellyfinApiController
|
|
|
|
|
[HttpDelete("UserPlayedItems/{itemId}")]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult<UserItemDataDto>> MarkUnplayedItem(
|
|
|
|
|
public async Task<ActionResult<UserItemDataDto?>> MarkUnplayedItem(
|
|
|
|
|
[FromQuery] Guid? userId,
|
|
|
|
|
[FromRoute, Required] Guid itemId)
|
|
|
|
|
{
|
|
|
|
@ -185,7 +185,7 @@ public class PlaystateController : BaseJellyfinApiController
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
[Obsolete("Kept for backwards compatibility")]
|
|
|
|
|
[ApiExplorerSettings(IgnoreApi = true)]
|
|
|
|
|
public Task<ActionResult<UserItemDataDto>> MarkUnplayedItemLegacy(
|
|
|
|
|
public Task<ActionResult<UserItemDataDto?>> MarkUnplayedItemLegacy(
|
|
|
|
|
[FromRoute, Required] Guid userId,
|
|
|
|
|
[FromRoute, Required] Guid itemId)
|
|
|
|
|
=> MarkUnplayedItem(userId, itemId);
|
|
|
|
@ -502,7 +502,7 @@ public class PlaystateController : BaseJellyfinApiController
|
|
|
|
|
/// <param name="wasPlayed">if set to <c>true</c> [was played].</param>
|
|
|
|
|
/// <param name="datePlayed">The date played.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
private UserItemDataDto UpdatePlayedStatus(User user, BaseItem item, bool wasPlayed, DateTime? datePlayed)
|
|
|
|
|
private UserItemDataDto? UpdatePlayedStatus(User user, BaseItem item, bool wasPlayed, DateTime? datePlayed)
|
|
|
|
|
{
|
|
|
|
|
if (wasPlayed)
|
|
|
|
|
{
|
|
|
|
@ -513,7 +513,7 @@ public class PlaystateController : BaseJellyfinApiController
|
|
|
|
|
item.MarkUnplayed(user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _userDataRepository.GetUserDataDto(item, user)!;
|
|
|
|
|
return _userDataRepository.GetUserDataDto(item, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private PlayMethod ValidatePlayMethod(PlayMethod method, string? playSessionId)
|
|
|
|
|