mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-23 15:30:34 -04:00
Cleaning up the serializer
This commit is contained in:
parent
84f8d545a6
commit
2f53f2bc67
@ -1 +1 @@
|
||||
Subproject commit 1831074c9d21ccc238409b6c21520780ca666bea
|
||||
Subproject commit 3d9e34fe7bd7dfe969053412e27776c565bdfcd8
|
@ -67,7 +67,6 @@ namespace Kyoo.Controllers
|
||||
|
||||
public IEnumerable<Show> GetShows(string searchQuery)
|
||||
{
|
||||
// TODO use case insensitive queries.
|
||||
return (from show in _database.Shows from l in _database.CollectionLinks.DefaultIfEmpty()
|
||||
where l.CollectionID == null select show).AsEnumerable().Union(
|
||||
from collection in _database.Collections select collection.AsShow())
|
||||
|
@ -52,7 +52,13 @@ namespace Kyoo
|
||||
modelBuilder.Entity<Track>()
|
||||
.Property(t => t.IsForced)
|
||||
.ValueGeneratedNever();
|
||||
|
||||
|
||||
modelBuilder.Entity<Show>().Property(x => x.Title).HasColumnType("TEXT COLLATE NOCASE");
|
||||
modelBuilder.Entity<Collection>().Property(x => x.Name).HasColumnType("TEXT COLLATE NOCASE");
|
||||
modelBuilder.Entity<Episode>().Property(x => x.Title).HasColumnType("TEXT COLLATE NOCASE");
|
||||
modelBuilder.Entity<People>().Property(x => x.Name).HasColumnType("TEXT COLLATE NOCASE");
|
||||
modelBuilder.Entity<Genre>().Property(x => x.Name).HasColumnType("TEXT COLLATE NOCASE");
|
||||
modelBuilder.Entity<Studio>().Property(x => x.Name).HasColumnType("TEXT COLLATE NOCASE");
|
||||
|
||||
modelBuilder.Entity<GenreLink>()
|
||||
.HasKey(x => new {x.ShowID, x.GenreID});
|
||||
|
@ -13,7 +13,7 @@ using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace Kyoo.Controllers
|
||||
{
|
||||
public class JsonPropertySelector : DefaultContractResolver
|
||||
public class JsonPropertySelector : CamelCasePropertyNamesContractResolver
|
||||
{
|
||||
private readonly Dictionary<Type, HashSet<string>> _ignored;
|
||||
private readonly Dictionary<Type, HashSet<string>> _forceSerialize;
|
||||
@ -21,7 +21,7 @@ namespace Kyoo.Controllers
|
||||
public JsonPropertySelector()
|
||||
{
|
||||
_ignored = new Dictionary<Type, HashSet<string>>();
|
||||
_forceSerialize = new Dictionary<Type, HashSet<string>>();
|
||||
_forceSerialize = new Dictionary<Type, HashSet<string>>();
|
||||
}
|
||||
|
||||
public JsonPropertySelector(Dictionary<Type, HashSet<string>> ignored, Dictionary<Type, HashSet<string>> forceSerialize)
|
||||
@ -77,8 +77,8 @@ namespace Kyoo.Controllers
|
||||
{
|
||||
ContractResolver = new JsonPropertySelector(null, new Dictionary<Type, HashSet<string>>()
|
||||
{
|
||||
{typeof(Show), new HashSet<string> {"Genres", "Studio", "People", "Seasons"}},
|
||||
{typeof(Episode), new HashSet<string> {"Tracks"}}
|
||||
{typeof(Show), new HashSet<string> {"genres", "studio", "people", "seasons"}},
|
||||
{typeof(Episode), new HashSet<string> {"tracks"}}
|
||||
})
|
||||
},
|
||||
context.HttpContext.RequestServices.GetRequiredService<ArrayPool<char>>(),
|
||||
|
@ -6,6 +6,7 @@ using Kyoo.Controllers;
|
||||
namespace Kyoo.Api
|
||||
{
|
||||
[Route("api/shows")]
|
||||
[Route("api/show")]
|
||||
[ApiController]
|
||||
public class ShowsController : ControllerBase
|
||||
{
|
||||
|
@ -19,6 +19,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="IdentityServer4" Version="3.0.2" />
|
||||
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="3.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="3.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.0.0" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user