mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-03 13:44:22 -04:00
Fixed CustomType serialisation
This commit is contained in:
parent
ae641b7f3a
commit
f397fc5b98
@ -28,6 +28,7 @@ using MediaBrowser.Model.Dto;
|
|||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.LiveTv;
|
using MediaBrowser.Model.LiveTv;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
using Microsoft.AspNetCore.Http.Json;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using BaseItemDto = MediaBrowser.Controller.Entities.BaseItem;
|
using BaseItemDto = MediaBrowser.Controller.Entities.BaseItem;
|
||||||
@ -1485,12 +1486,18 @@ public sealed class BaseItemRepository(
|
|||||||
/// <returns>The dto to map.</returns>
|
/// <returns>The dto to map.</returns>
|
||||||
public BaseItemEntity Map(BaseItemDto dto)
|
public BaseItemEntity Map(BaseItemDto dto)
|
||||||
{
|
{
|
||||||
|
var dtoType = dto.GetType();
|
||||||
var entity = new BaseItemEntity()
|
var entity = new BaseItemEntity()
|
||||||
{
|
{
|
||||||
Type = dto.GetType().ToString(),
|
Type = dtoType.ToString(),
|
||||||
Id = dto.Id
|
Id = dto.Id
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (TypeRequiresDeserialization(dtoType))
|
||||||
|
{
|
||||||
|
entity.Data = JsonSerializer.Serialize(dto, dtoType, JsonDefaults.Options);
|
||||||
|
}
|
||||||
|
|
||||||
entity.ParentId = !dto.ParentId.IsEmpty() ? dto.ParentId : null;
|
entity.ParentId = !dto.ParentId.IsEmpty() ? dto.ParentId : null;
|
||||||
entity.Path = GetPathToSave(dto.Path);
|
entity.Path = GetPathToSave(dto.Path);
|
||||||
entity.EndDate = dto.EndDate.GetValueOrDefault();
|
entity.EndDate = dto.EndDate.GetValueOrDefault();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user