mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fixing the json serializer
This commit is contained in:
parent
faf453e64a
commit
7e8ab3b173
@ -302,8 +302,9 @@ namespace Kyoo.Controllers
|
|||||||
(Show s, nameof(Show.Collections)) => CollectionRepository
|
(Show s, nameof(Show.Collections)) => CollectionRepository
|
||||||
.GetAll(Utility.ResourceEquals<Collection>(obj))
|
.GetAll(Utility.ResourceEquals<Collection>(obj))
|
||||||
.Then(x => s.Collections = x),
|
.Then(x => s.Collections = x),
|
||||||
|
// TODO Studio loading does not work.
|
||||||
(Show s, nameof(Show.Studio)) => StudioRepository
|
(Show s, nameof(Show.Studio)) => StudioRepository
|
||||||
.Get(x => x.Shows.Any(Utility.ResourceEqualsFunc<Show>(obj)))
|
.Get(x => x.Shows.Any(y => y.ID == obj.ID || y.Slug == obj.Slug))
|
||||||
.Then(x => s.Studio = x),
|
.Then(x => s.Studio = x),
|
||||||
|
|
||||||
(Season s, nameof(Season.ExternalIDs)) => ProviderRepository
|
(Season s, nameof(Season.ExternalIDs)) => ProviderRepository
|
||||||
|
@ -11,14 +11,12 @@ namespace Kyoo.Controllers
|
|||||||
{
|
{
|
||||||
JsonProperty property = base.CreateProperty(member, memberSerialization);
|
JsonProperty property = base.CreateProperty(member, memberSerialization);
|
||||||
|
|
||||||
// TODO this get called only once and get cached.
|
if (member?.GetCustomAttribute<LoadableRelationAttribute>() != null)
|
||||||
|
property.NullValueHandling = NullValueHandling.Ignore;
|
||||||
// if (member?.GetCustomAttributes<LoadableRelationAttribute>() != null)
|
if (member?.GetCustomAttribute<SerializeIgnoreAttribute>() != null)
|
||||||
// property.NullValueHandling = NullValueHandling.Ignore;
|
property.ShouldSerialize = _ => false;
|
||||||
// if (member?.GetCustomAttributes<SerializeIgnoreAttribute>() != null)
|
if (member?.GetCustomAttribute<DeserializeIgnoreAttribute>() != null)
|
||||||
// property.ShouldSerialize = _ => false;
|
property.ShouldDeserialize = _ => false;
|
||||||
// if (member?.GetCustomAttributes<DeserializeIgnoreAttribute>() != null)
|
|
||||||
// property.ShouldDeserialize = _ => false;
|
|
||||||
return property;
|
return property;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace Kyoo.CommonApi
|
|||||||
where.Remove(key);
|
where.Remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
string[] fields = context.HttpContext.Request.Query["fields"].ToArray();
|
string[] fields = string.Join(',', context.HttpContext.Request.Query["fields"]).Split(',');
|
||||||
|
|
||||||
context.HttpContext.Items["fields"] = fields;
|
context.HttpContext.Items["fields"] = fields;
|
||||||
if (context.ActionDescriptor is ControllerActionDescriptor descriptor)
|
if (context.ActionDescriptor is ControllerActionDescriptor descriptor)
|
||||||
@ -68,6 +68,7 @@ namespace Kyoo.CommonApi
|
|||||||
Type pageType = Utility.GetGenericDefinition(result.DeclaredType, typeof(Page<>));
|
Type pageType = Utility.GetGenericDefinition(result.DeclaredType, typeof(Page<>));
|
||||||
|
|
||||||
|
|
||||||
|
// TODO loading is case sensitive. Maybe convert them in the first check.
|
||||||
if (pageType != null)
|
if (pageType != null)
|
||||||
{
|
{
|
||||||
foreach (IResource resource in ((dynamic)result.Value).Items)
|
foreach (IResource resource in ((dynamic)result.Value).Items)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user