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
|
||||
.GetAll(Utility.ResourceEquals<Collection>(obj))
|
||||
.Then(x => s.Collections = x),
|
||||
// TODO Studio loading does not work.
|
||||
(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),
|
||||
|
||||
(Season s, nameof(Season.ExternalIDs)) => ProviderRepository
|
||||
|
@ -11,14 +11,12 @@ namespace Kyoo.Controllers
|
||||
{
|
||||
JsonProperty property = base.CreateProperty(member, memberSerialization);
|
||||
|
||||
// TODO this get called only once and get cached.
|
||||
|
||||
// if (member?.GetCustomAttributes<LoadableRelationAttribute>() != null)
|
||||
// property.NullValueHandling = NullValueHandling.Ignore;
|
||||
// if (member?.GetCustomAttributes<SerializeIgnoreAttribute>() != null)
|
||||
// property.ShouldSerialize = _ => false;
|
||||
// if (member?.GetCustomAttributes<DeserializeIgnoreAttribute>() != null)
|
||||
// property.ShouldDeserialize = _ => false;
|
||||
if (member?.GetCustomAttribute<LoadableRelationAttribute>() != null)
|
||||
property.NullValueHandling = NullValueHandling.Ignore;
|
||||
if (member?.GetCustomAttribute<SerializeIgnoreAttribute>() != null)
|
||||
property.ShouldSerialize = _ => false;
|
||||
if (member?.GetCustomAttribute<DeserializeIgnoreAttribute>() != null)
|
||||
property.ShouldDeserialize = _ => false;
|
||||
return property;
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace Kyoo.CommonApi
|
||||
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;
|
||||
if (context.ActionDescriptor is ControllerActionDescriptor descriptor)
|
||||
@ -68,6 +68,7 @@ namespace Kyoo.CommonApi
|
||||
Type pageType = Utility.GetGenericDefinition(result.DeclaredType, typeof(Page<>));
|
||||
|
||||
|
||||
// TODO loading is case sensitive. Maybe convert them in the first check.
|
||||
if (pageType != null)
|
||||
{
|
||||
foreach (IResource resource in ((dynamic)result.Value).Items)
|
||||
|
Loading…
x
Reference in New Issue
Block a user