diff --git a/Kyoo.Common/Kyoo.Common.csproj b/Kyoo.Common/Kyoo.Common.csproj
index c4c2f3d6..ec328eab 100644
--- a/Kyoo.Common/Kyoo.Common.csproj
+++ b/Kyoo.Common/Kyoo.Common.csproj
@@ -16,8 +16,6 @@
truesnupkgdefault
-
-
diff --git a/Kyoo.Common/Models/Attributes/LinkAttribute.cs b/Kyoo.Common/Models/Attributes/LinkAttribute.cs
deleted file mode 100644
index d98ad90a..00000000
--- a/Kyoo.Common/Models/Attributes/LinkAttribute.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using JetBrains.Annotations;
-using Kyoo.Models.Attributes;
-
-namespace Kyoo.Common.Models.Attributes
-{
- ///
- /// An attribute to mark Link properties on resource.
- ///
- [AttributeUsage(AttributeTargets.Property)]
- [MeansImplicitUse]
- public class LinkAttribute : SerializeIgnoreAttribute { }
-}
\ No newline at end of file
diff --git a/Kyoo.Common/Models/PeopleRole.cs b/Kyoo.Common/Models/PeopleRole.cs
index 062bb3e8..daf9c7cd 100644
--- a/Kyoo.Common/Models/PeopleRole.cs
+++ b/Kyoo.Common/Models/PeopleRole.cs
@@ -17,8 +17,8 @@ namespace Kyoo.Models
public string Slug => ForPeople ? Show.Slug : People.Slug;
///
- /// Should this role be used as a Show substitute (the value is false) or
- /// as a People substitute (the value is true).
+ /// Should this role be used as a Show substitute (the value is true) or
+ /// as a People substitute (the value is false).
///
public bool ForPeople { get; set; }
diff --git a/Kyoo.Common/Models/Resources/Collection.cs b/Kyoo.Common/Models/Resources/Collection.cs
index ad85ad34..50a4ede8 100644
--- a/Kyoo.Common/Models/Resources/Collection.cs
+++ b/Kyoo.Common/Models/Resources/Collection.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using Kyoo.Common.Models.Attributes;
+using System;
+using System.Collections.Generic;
using Kyoo.Models.Attributes;
namespace Kyoo.Models
@@ -30,6 +30,7 @@ namespace Kyoo.Models
/// This can be disabled using the internal query flag.
///
[SerializeAs("{HOST}/api/collection/{Slug}/poster")]
+ [Obsolete("Use Images instead of this, this is only kept for the API response.")]
public string Poster => Images?.GetValueOrDefault(Thumbnails.Poster);
///
@@ -49,18 +50,5 @@ namespace Kyoo.Models
///
[EditableRelation] [LoadableRelation] public ICollection ExternalIDs { get; set; }
-
-#if ENABLE_INTERNAL_LINKS
-
- ///
- /// The internal link between this collection and shows in the list.
- ///
- [Link] public ICollection> ShowLinks { get; set; }
-
- ///
- /// The internal link between this collection and libraries in the list.
- ///
- [Link] public ICollection> LibraryLinks { get; set; }
-#endif
}
}
diff --git a/Kyoo.Common/Models/Resources/Episode.cs b/Kyoo.Common/Models/Resources/Episode.cs
index 2ab30437..3f29088f 100644
--- a/Kyoo.Common/Models/Resources/Episode.cs
+++ b/Kyoo.Common/Models/Resources/Episode.cs
@@ -74,9 +74,13 @@ namespace Kyoo.Models
///
[SerializeIgnore] public int? SeasonID { get; set; }
///
- /// The season that contains this episode. This must be explicitly loaded via a call to .
- /// This can be null if the season is unknown and the episode is only identified by it's .
+ /// The season that contains this episode.
+ /// This must be explicitly loaded via a call to .
///
+ ///
+ /// This can be null if the season is unknown and the episode is only identified
+ /// by it's .
+ ///
[LoadableRelation(nameof(SeasonID))] public Season Season { get; set; }
///
@@ -108,6 +112,7 @@ namespace Kyoo.Models
/// This can be disabled using the internal query flag.
///
[SerializeAs("{HOST}/api/episodes/{Slug}/thumb")]
+ [Obsolete("Use Images instead of this, this is only kept for the API response.")]
public string Thumb => Images?.GetValueOrDefault(Thumbnails.Thumbnail);
///
diff --git a/Kyoo.Common/Models/Resources/Genre.cs b/Kyoo.Common/Models/Resources/Genre.cs
index c7aaa76f..e5fcbed8 100644
--- a/Kyoo.Common/Models/Resources/Genre.cs
+++ b/Kyoo.Common/Models/Resources/Genre.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using Kyoo.Common.Models.Attributes;
using Kyoo.Models.Attributes;
namespace Kyoo.Models
@@ -24,14 +23,7 @@ namespace Kyoo.Models
/// The list of shows that have this genre.
///
[LoadableRelation] public ICollection Shows { get; set; }
-
-#if ENABLE_INTERNAL_LINKS
- ///
- /// The internal link between this genre and shows in the list.
- ///
- [Link] public ICollection> ShowLinks { get; set; }
-#endif
-
+
///
/// Create a new, empty .
///
diff --git a/Kyoo.Common/Models/Resources/Library.cs b/Kyoo.Common/Models/Resources/Library.cs
index a72d6a37..6580f988 100644
--- a/Kyoo.Common/Models/Resources/Library.cs
+++ b/Kyoo.Common/Models/Resources/Library.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using Kyoo.Common.Models.Attributes;
using Kyoo.Models.Attributes;
namespace Kyoo.Models
@@ -39,22 +38,5 @@ namespace Kyoo.Models
/// The list of collections in this library.
///
[LoadableRelation] public ICollection Collections { get; set; }
-
-#if ENABLE_INTERNAL_LINKS
- ///
- /// The internal link between this library and provider in the list.
- ///
- [Link] public ICollection> ProviderLinks { get; set; }
-
- ///
- /// The internal link between this library and shows in the list.
- ///
- [Link] public ICollection> ShowLinks { get; set; }
-
- ///
- /// The internal link between this library and collection in the list.
- ///
- [Link] public ICollection> CollectionLinks { get; set; }
-#endif
}
}
diff --git a/Kyoo.Common/Models/Resources/People.cs b/Kyoo.Common/Models/Resources/People.cs
index d555a10d..ff6fd576 100644
--- a/Kyoo.Common/Models/Resources/People.cs
+++ b/Kyoo.Common/Models/Resources/People.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Kyoo.Models.Attributes;
namespace Kyoo.Models
@@ -28,6 +29,7 @@ namespace Kyoo.Models
/// This can be disabled using the internal query flag.
///
[SerializeAs("{HOST}/api/people/{Slug}/poster")]
+ [Obsolete("Use Images instead of this, this is only kept for the API response.")]
public string Poster => Images?.GetValueOrDefault(Thumbnails.Poster);
///
diff --git a/Kyoo.Common/Models/Resources/Provider.cs b/Kyoo.Common/Models/Resources/Provider.cs
index 35f94fc9..db118de2 100644
--- a/Kyoo.Common/Models/Resources/Provider.cs
+++ b/Kyoo.Common/Models/Resources/Provider.cs
@@ -1,5 +1,5 @@
+using System;
using System.Collections.Generic;
-using Kyoo.Common.Models.Attributes;
using Kyoo.Controllers;
using Kyoo.Models.Attributes;
@@ -31,20 +31,14 @@ namespace Kyoo.Models
/// This can be disabled using the internal query flag.
///
[SerializeAs("{HOST}/api/providers/{Slug}/logo")]
+ [Obsolete("Use Images instead of this, this is only kept for the API response.")]
public string Logo => Images?.GetValueOrDefault(Thumbnails.Logo);
///
/// The list of libraries that uses this provider.
///
[LoadableRelation] public ICollection Libraries { get; set; }
-
-#if ENABLE_INTERNAL_LINKS
- ///
- /// The internal link between this provider and libraries in the list.
- ///
- [Link] public ICollection> LibraryLinks { get; set; }
-#endif
-
+
///
/// Create a new, default,
///
diff --git a/Kyoo.Common/Models/Resources/Season.cs b/Kyoo.Common/Models/Resources/Season.cs
index 46639c3c..2cfadfb9 100644
--- a/Kyoo.Common/Models/Resources/Season.cs
+++ b/Kyoo.Common/Models/Resources/Season.cs
@@ -45,7 +45,8 @@ namespace Kyoo.Models
///
[SerializeIgnore] public int ShowID { get; set; }
///
- /// The show that contains this season. This must be explicitly loaded via a call to .
+ /// The show that contains this season.
+ /// This must be explicitly loaded via a call to .
///
[LoadableRelation(nameof(ShowID))] public Show Show { get; set; }
@@ -83,6 +84,7 @@ namespace Kyoo.Models
/// This can be disabled using the internal query flag.
///
[SerializeAs("{HOST}/api/seasons/{Slug}/thumb")]
+ [Obsolete("Use Images instead of this, this is only kept for the API response.")]
public string Poster => Images?.GetValueOrDefault(Thumbnails.Poster);
///
diff --git a/Kyoo.Common/Models/Resources/Show.cs b/Kyoo.Common/Models/Resources/Show.cs
index afaaa481..50059692 100644
--- a/Kyoo.Common/Models/Resources/Show.cs
+++ b/Kyoo.Common/Models/Resources/Show.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using Kyoo.Common.Models.Attributes;
using Kyoo.Controllers;
using Kyoo.Models.Attributes;
@@ -47,6 +46,7 @@ namespace Kyoo.Models
/// An URL to a trailer. This could be any path supported by the .
///
/// TODO for now, this is set to a youtube url. It should be cached and converted to a local file.
+ [Obsolete("Use Images instead of this, this is only kept for the API response.")]
public string TrailerUrl => Images?.GetValueOrDefault(Thumbnails.Trailer);
///
@@ -70,6 +70,7 @@ namespace Kyoo.Models
/// This can be disabled using the internal query flag.
///
[SerializeAs("{HOST}/api/shows/{Slug}/poster")]
+ [Obsolete("Use Images instead of this, this is only kept for the API response.")]
public string Poster => Images?.GetValueOrDefault(Thumbnails.Poster);
///
@@ -78,6 +79,7 @@ namespace Kyoo.Models
/// This can be disabled using the internal query flag.
///
[SerializeAs("{HOST}/api/shows/{Slug}/logo")]
+ [Obsolete("Use Images instead of this, this is only kept for the API response.")]
public string Logo => Images?.GetValueOrDefault(Thumbnails.Logo);
///
@@ -86,6 +88,7 @@ namespace Kyoo.Models
/// This can be disabled using the internal query flag.
///
[SerializeAs("{HOST}/api/shows/{Slug}/backdrop")]
+ [Obsolete("Use Images instead of this, this is only kept for the API response.")]
public string Backdrop => Images?.GetValueOrDefault(Thumbnails.Thumbnail);
///
@@ -101,7 +104,8 @@ namespace Kyoo.Models
///
[SerializeIgnore] public int? StudioID { get; set; }
///
- /// The Studio that made this show. This must be explicitly loaded via a call to .
+ /// The Studio that made this show.
+ /// This must be explicitly loaded via a call to .
///
[LoadableRelation(nameof(StudioID))] [EditableRelation] public Studio Studio { get; set; }
@@ -137,23 +141,6 @@ namespace Kyoo.Models
///
[LoadableRelation] public ICollection Collections { get; set; }
-#if ENABLE_INTERNAL_LINKS
- ///
- /// The internal link between this show and libraries in the list.
- ///
- [Link] public ICollection> LibraryLinks { get; set; }
-
- ///
- /// The internal link between this show and collections in the list.
- ///
- [Link] public ICollection> CollectionLinks { get; set; }
-
- ///
- /// The internal link between this show and genres in the list.
- ///
- [Link] public ICollection> GenreLinks { get; set; }
-#endif
-
///
public void OnMerge(object merged)
{
diff --git a/Kyoo.Common/Models/Resources/User.cs b/Kyoo.Common/Models/Resources/User.cs
index 8cae9671..3400df62 100644
--- a/Kyoo.Common/Models/Resources/User.cs
+++ b/Kyoo.Common/Models/Resources/User.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using Kyoo.Common.Models.Attributes;
namespace Kyoo.Models
{
@@ -51,13 +50,6 @@ namespace Kyoo.Models
/// The list of episodes the user is watching (stopped in progress or the next episode of the show)
///
public ICollection CurrentlyWatching { get; set; }
-
-#if ENABLE_INTERNAL_LINKS
- ///
- /// Links between Users and Shows.
- ///
- [Link] public ICollection> ShowLinks { get; set; }
-#endif
}
///
diff --git a/Kyoo.Tests/Database/SpecificTests/ShowTests.cs b/Kyoo.Tests/Database/SpecificTests/ShowTests.cs
index 2f87afca..424ca76c 100644
--- a/Kyoo.Tests/Database/SpecificTests/ShowTests.cs
+++ b/Kyoo.Tests/Database/SpecificTests/ShowTests.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using FluentAssertions;
using Kyoo.Controllers;
using Kyoo.Models;
using Microsoft.EntityFrameworkCore;
@@ -243,9 +244,25 @@ namespace Kyoo.Tests.Database
.ThenInclude(x => x.Provider)
.Include(x => x.Genres)
.Include(x => x.People)
+ .ThenInclude(x => x.People)
.Include(x => x.Studio)
.FirstAsync(x => x.ID == created.ID);
- KAssert.DeepEqual(expected, retrieved);
+ retrieved.People.ForEach(x =>
+ {
+ x.Show = null;
+ x.People.Roles = null;
+ });
+ retrieved.Studio.Shows = null;
+ retrieved.Genres.ForEach(x => x.Shows = null);
+
+ expected.Genres.ForEach(x => x.Shows = null);
+ expected.People.ForEach(x =>
+ {
+ x.Show = null;
+ x.People.Roles = null;
+ });
+
+ retrieved.Should().BeEquivalentTo(expected);
}
[Fact]
diff --git a/Kyoo/Controllers/Repositories/ShowRepository.cs b/Kyoo/Controllers/Repositories/ShowRepository.cs
index c0f29cec..1c7471f7 100644
--- a/Kyoo/Controllers/Repositories/ShowRepository.cs
+++ b/Kyoo/Controllers/Repositories/ShowRepository.cs
@@ -89,7 +89,10 @@ namespace Kyoo.Controllers
{
await base.Validate(resource);
if (resource.Studio != null)
+ {
resource.Studio = await _studios.CreateIfNotExists(resource.Studio);
+ resource.StudioID = resource.Studio.ID;
+ }
if (resource.Genres != null)
{