mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 19:37:55 +02:00
add proper converter for legacy datetime
This commit is contained in:
parent
b0532c549a
commit
3ba1f4c901
1 changed files with 4 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Globalization;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Jellyfin.Api.Constants;
|
using Jellyfin.Api.Constants;
|
||||||
using Jellyfin.Api.Helpers;
|
using Jellyfin.Api.Helpers;
|
||||||
|
@ -74,21 +74,15 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult<UserItemDataDto> MarkPlayedItem(
|
public ActionResult<UserItemDataDto> MarkPlayedItem(
|
||||||
[FromRoute] Guid userId,
|
[FromRoute] Guid userId,
|
||||||
[FromRoute] Guid itemId,
|
[FromRoute] Guid itemId,
|
||||||
[FromQuery] string? datePlayed)
|
[FromQuery] DateTime? datePlayed)
|
||||||
{
|
{
|
||||||
DateTime? parsedDatePlayed = null;
|
|
||||||
if (!string.IsNullOrEmpty(datePlayed))
|
|
||||||
{
|
|
||||||
parsedDatePlayed = DateTime.ParseExact(datePlayed, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
|
|
||||||
}
|
|
||||||
|
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
var session = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
|
var session = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
|
||||||
var dto = UpdatePlayedStatus(user, itemId, true, parsedDatePlayed);
|
var dto = UpdatePlayedStatus(user, itemId, true, datePlayed);
|
||||||
foreach (var additionalUserInfo in session.AdditionalUsers)
|
foreach (var additionalUserInfo in session.AdditionalUsers)
|
||||||
{
|
{
|
||||||
var additionalUser = _userManager.GetUserById(additionalUserInfo.UserId);
|
var additionalUser = _userManager.GetUserById(additionalUserInfo.UserId);
|
||||||
UpdatePlayedStatus(additionalUser, itemId, true, parsedDatePlayed);
|
UpdatePlayedStatus(additionalUser, itemId, true, datePlayed);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dto;
|
return dto;
|
||||||
|
|
Loading…
Reference in a new issue