Finishing the Lazy load migration and solving some bugs with the API

This commit is contained in:
Zoe Roux
2020-02-10 22:17:49 +01:00
parent cbc10acf54
commit d28f976d2b
7 changed files with 41 additions and 16 deletions
+4 -1
View File
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Kyoo.Models
{
@@ -7,6 +8,8 @@ namespace Kyoo.Models
[JsonIgnore] public long ID { get; set; }
public string Slug { get; set; }
public string Name { get; set; }
// public IEnumerable<Show> Shows { get; set; }
public Genre(string slug, string name)
{
+8 -3
View File
@@ -2,12 +2,17 @@ namespace Kyoo.Models
{
public class GenreLink
{
// TODO Make json serializer ignore this class and only serialize the Genre child.
// TODO include this class in the EF workflows.
public long ShowID { get; set; }
public virtual Show Show { get; set; }
public long GenreID { get; set; }
public virtual Genre Genre { get; set; }
public GenreLink() {}
public GenreLink(Show show, Genre genre)
{
Show = show;
Genre = genre;
}
}
}
+6 -1
View File
@@ -6,7 +6,12 @@ namespace Kyoo.Models
{
[JsonIgnore] public long ID { get; set; }
[JsonIgnore] public long PeopleID { get; set; }
public virtual People People { get; set; }
[JsonIgnore] public virtual People People { get; set; }
public string Slug => People.Slug;
public string Name => People.Name;
public string ExternalIDs => People.ExternalIDs;
[JsonIgnore] public long ShowID { get; set; }
[JsonIgnore] public virtual Show Show { get; set; }
public string Role { get; set; }
+6 -1
View File
@@ -29,7 +29,12 @@ namespace Kyoo.Models
public bool IsCollection;
public virtual IEnumerable<Genre> Genres { get; set; }
public virtual IEnumerable<Genre> Genres
{
get { return GenreLinks?.Select(x => x.Genre); }
set { GenreLinks = value?.Select(x => new GenreLink(this, x)).ToList(); }
}
[JsonIgnore] public virtual List<GenreLink> GenreLinks { get; set; }
public virtual Studio Studio { get; set; }
public virtual IEnumerable<PeopleLink> People { get; set; }
public virtual IEnumerable<Season> Seasons { get; set; }
+2 -2
View File
@@ -56,7 +56,7 @@ namespace Kyoo.Models
public class Track : Stream
{
public int ID { get; set; }
[JsonIgnore] public long ID { get; set; }
[JsonIgnore] public long EpisodeID { get; set; }
public bool IsDefault
{
@@ -72,7 +72,7 @@ namespace Kyoo.Models
public string Link;
[JsonIgnore] public bool IsExternal { get; set; }
public virtual Episode Episode { get; set; }
[JsonIgnore] public virtual Episode Episode { get; set; }
public Track() { }