Remove some json ignores on ids

This commit is contained in:
Zoe Roux 2024-03-22 21:51:42 +01:00
parent 0c0037416a
commit ec6b90b33c
No known key found for this signature in database
4 changed files with 2 additions and 10 deletions

View File

@ -129,7 +129,6 @@ namespace Kyoo.Abstractions.Models
/// <summary>
/// The ID of the Studio that made this show.
/// </summary>
[JsonIgnore]
public Guid? StudioId { get; set; }
/// <summary>

View File

@ -57,7 +57,6 @@ namespace Kyoo.Abstractions.Models
/// <summary>
/// The ID of the user that started watching this episode.
/// </summary>
[SerializeIgnore]
public Guid UserId { get; set; }
/// <summary>
@ -69,7 +68,6 @@ namespace Kyoo.Abstractions.Models
/// <summary>
/// The ID of the movie started.
/// </summary>
[SerializeIgnore]
public Guid MovieId { get; set; }
/// <summary>
@ -114,7 +112,6 @@ namespace Kyoo.Abstractions.Models
/// <summary>
/// The ID of the user that started watching this episode.
/// </summary>
[SerializeIgnore]
public Guid UserId { get; set; }
/// <summary>
@ -126,7 +123,6 @@ namespace Kyoo.Abstractions.Models
/// <summary>
/// The ID of the episode started.
/// </summary>
[SerializeIgnore]
public Guid? EpisodeId { get; set; }
/// <summary>
@ -171,7 +167,6 @@ namespace Kyoo.Abstractions.Models
/// <summary>
/// The ID of the user that started watching this episode.
/// </summary>
[SerializeIgnore]
public Guid UserId { get; set; }
/// <summary>
@ -183,7 +178,6 @@ namespace Kyoo.Abstractions.Models
/// <summary>
/// The ID of the show started.
/// </summary>
[SerializeIgnore]
public Guid ShowId { get; set; }
/// <summary>
@ -213,7 +207,6 @@ namespace Kyoo.Abstractions.Models
/// <summary>
/// The ID of the episode started.
/// </summary>
[SerializeIgnore]
public Guid? NextEpisodeId { get; set; }
/// <summary>

View File

@ -96,7 +96,7 @@ namespace Kyoo.Core
.AddJsonOptions(x =>
{
x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
x.JsonSerializerOptions.TypeInfoResolver = new PolymorphicTypeResolver();
x.JsonSerializerOptions.TypeInfoResolver = new WithKindResolver();
x.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
})
.AddDataAnnotations()

View File

@ -26,7 +26,7 @@ using static System.Text.Json.JsonNamingPolicy;
namespace Kyoo.Core.Api;
public class PolymorphicTypeResolver : DefaultJsonTypeInfoResolver
public class WithKindResolver : DefaultJsonTypeInfoResolver
{
public override JsonTypeInfo GetTypeInfo(Type type, JsonSerializerOptions options)
{