diff --git a/Kyoo.Abstractions/Controllers/IRepository.cs b/Kyoo.Abstractions/Controllers/IRepository.cs
index 68bf5737..0888d114 100644
--- a/Kyoo.Abstractions/Controllers/IRepository.cs
+++ b/Kyoo.Abstractions/Controllers/IRepository.cs
@@ -6,119 +6,9 @@ using System.Threading.Tasks;
using JetBrains.Annotations;
using Kyoo.Abstractions.Models;
using Kyoo.Abstractions.Models.Exceptions;
-using Kyoo.Utils;
namespace Kyoo.Abstractions.Controllers
{
- ///
- /// Information about the pagination. How many items should be displayed and where to start.
- ///
- public readonly struct Pagination
- {
- ///
- /// The count of items to return.
- ///
- public int Count { get; }
-
- ///
- /// Where to start? Using the given sort.
- ///
- public int AfterID { get; }
-
- ///
- /// Create a new instance.
- ///
- /// Set the value
- /// Set the value. If not specified, it will start from the start
- public Pagination(int count, int afterID = 0)
- {
- Count = count;
- AfterID = afterID;
- }
-
- ///
- /// Implicitly create a new pagination from a limit number.
- ///
- /// Set the value
- /// A new instance
- public static implicit operator Pagination(int limit) => new(limit);
- }
-
- ///
- /// Information about how a query should be sorted. What factor should decide the sort and in which order.
- ///
- /// For witch type this sort applies
- public readonly struct Sort
- {
- ///
- /// The sort key. This member will be used to sort the results.
- ///
- public Expression> Key { get; }
-
- ///
- /// If this is set to true, items will be sorted in descend order else, they will be sorted in ascendant order.
- ///
- public bool Descendant { get; }
-
- ///
- /// Create a new instance.
- ///
- /// The sort key given. It is assigned to .
- /// Should this be in descendant order? The default is false.
- /// If the given key is not a member.
- public Sort(Expression> key, bool descendant = false)
- {
- Key = key;
- Descendant = descendant;
-
- if (!Utility.IsPropertyExpression(Key))
- throw new ArgumentException("The given sort key is not valid.");
- }
-
- ///
- /// Create a new instance from a key's name (case insensitive).
- ///
- /// A key name with an optional order specifier. Format: "key:asc", "key:desc" or "key".
- /// An invalid key or sort specifier as been given.
- public Sort(string sortBy)
- {
- if (string.IsNullOrEmpty(sortBy))
- {
- Key = null;
- Descendant = false;
- return;
- }
-
- string key = sortBy.Contains(':') ? sortBy[..sortBy.IndexOf(':')] : sortBy;
- string order = sortBy.Contains(':') ? sortBy[(sortBy.IndexOf(':') + 1)..] : null;
-
- ParameterExpression param = Expression.Parameter(typeof(T), "x");
- MemberExpression property = Expression.Property(param, key);
- Key = property.Type.IsValueType
- ? Expression.Lambda>(Expression.Convert(property, typeof(object)), param)
- : Expression.Lambda>(property, param);
-
- Descendant = order switch
- {
- "desc" => true,
- "asc" => false,
- null => false,
- _ => throw new ArgumentException($"The sort order, if set, should be :asc or :desc but it was :{order}.")
- };
- }
- }
-
- ///
- /// A base class for repositories. Every service implementing this will be handled by the .
- ///
- public interface IBaseRepository
- {
- ///
- /// The type for witch this repository is responsible or null if non applicable.
- ///
- Type RepositoryType { get; }
- }
-
///
/// A common repository for every resources.
///
@@ -276,6 +166,17 @@ namespace Kyoo.Abstractions.Controllers
Task DeleteAll([NotNull] Expression> where);
}
+ ///
+ /// A base class for repositories. Every service implementing this will be handled by the .
+ ///
+ public interface IBaseRepository
+ {
+ ///
+ /// The type for witch this repository is responsible or null if non applicable.
+ ///
+ Type RepositoryType { get; }
+ }
+
///
/// A repository to handle shows.
///
diff --git a/Kyoo.Abstractions/Models/Attributes/Serializer/DeserializeIgnoreAttribute.cs b/Kyoo.Abstractions/Models/Attributes/Serializer/DeserializeIgnoreAttribute.cs
new file mode 100644
index 00000000..bbf3f89e
--- /dev/null
+++ b/Kyoo.Abstractions/Models/Attributes/Serializer/DeserializeIgnoreAttribute.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Kyoo.Abstractions.Models.Attributes
+{
+ ///
+ /// Remove a property from the deserialization pipeline. The user can't input value for this property.
+ ///
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
+ public class DeserializeIgnoreAttribute : Attribute { }
+}
diff --git a/Kyoo.Abstractions/Models/Attributes/SerializeAttribute.cs b/Kyoo.Abstractions/Models/Attributes/Serializer/SerializeAsAttribute.cs
similarity index 68%
rename from Kyoo.Abstractions/Models/Attributes/SerializeAttribute.cs
rename to Kyoo.Abstractions/Models/Attributes/Serializer/SerializeAsAttribute.cs
index 3424420c..334bf83a 100644
--- a/Kyoo.Abstractions/Models/Attributes/SerializeAttribute.cs
+++ b/Kyoo.Abstractions/Models/Attributes/Serializer/SerializeAsAttribute.cs
@@ -1,19 +1,7 @@
-using System;
+using System;
namespace Kyoo.Abstractions.Models.Attributes
{
- ///
- /// Remove an property from the serialization pipeline. It will simply be skipped.
- ///
- [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
- public class SerializeIgnoreAttribute : Attribute { }
-
- ///
- /// Remove a property from the deserialization pipeline. The user can't input value for this property.
- ///
- [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
- public class DeserializeIgnoreAttribute : Attribute { }
-
///
/// Change the way the field is serialized. It allow one to use a string format like formatting instead of the default value.
/// This can be disabled for a request by setting the "internal" query string parameter to true.
diff --git a/Kyoo.Abstractions/Models/Attributes/Serializer/SerializeIgnoreAttribute.cs b/Kyoo.Abstractions/Models/Attributes/Serializer/SerializeIgnoreAttribute.cs
new file mode 100644
index 00000000..fae2999b
--- /dev/null
+++ b/Kyoo.Abstractions/Models/Attributes/Serializer/SerializeIgnoreAttribute.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Kyoo.Abstractions.Models.Attributes
+{
+ ///
+ /// Remove an property from the serialization pipeline. It will simply be skipped.
+ ///
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
+ public class SerializeIgnoreAttribute : Attribute { }
+}
diff --git a/Kyoo.Abstractions/Models/LibraryItem.cs b/Kyoo.Abstractions/Models/LibraryItem.cs
index 3d1d4f87..c9c6b23d 100644
--- a/Kyoo.Abstractions/Models/LibraryItem.cs
+++ b/Kyoo.Abstractions/Models/LibraryItem.cs
@@ -16,7 +16,7 @@ namespace Kyoo.Abstractions.Models
Show,
///
- /// The is a Movie (a with equals to true).
+ /// The is a Movie (a with equals to true).
///
Movie,
diff --git a/Kyoo.Abstractions/Models/Resources/WatchedEpisode.cs b/Kyoo.Abstractions/Models/Resources/WatchedEpisode.cs
index 8f17dd1a..bda9d17c 100644
--- a/Kyoo.Abstractions/Models/Resources/WatchedEpisode.cs
+++ b/Kyoo.Abstractions/Models/Resources/WatchedEpisode.cs
@@ -1,6 +1,4 @@
-using System.Collections.Generic;
-
-namespace Kyoo.Abstractions.Models
+namespace Kyoo.Abstractions.Models
{
///
/// Metadata of episode currently watching by an user
diff --git a/Kyoo.Abstractions/Models/AsyncRef.cs b/Kyoo.Abstractions/Models/Utils/AsyncRef.cs
similarity index 100%
rename from Kyoo.Abstractions/Models/AsyncRef.cs
rename to Kyoo.Abstractions/Models/Utils/AsyncRef.cs
diff --git a/Kyoo.Abstractions/Models/Utils/Pagination.cs b/Kyoo.Abstractions/Models/Utils/Pagination.cs
new file mode 100644
index 00000000..e7a48c95
--- /dev/null
+++ b/Kyoo.Abstractions/Models/Utils/Pagination.cs
@@ -0,0 +1,36 @@
+namespace Kyoo.Abstractions.Controllers
+{
+ ///
+ /// Information about the pagination. How many items should be displayed and where to start.
+ ///
+ public readonly struct Pagination
+ {
+ ///
+ /// The count of items to return.
+ ///
+ public int Count { get; }
+
+ ///
+ /// Where to start? Using the given sort.
+ ///
+ public int AfterID { get; }
+
+ ///
+ /// Create a new instance.
+ ///
+ /// Set the value
+ /// Set the value. If not specified, it will start from the start
+ public Pagination(int count, int afterID = 0)
+ {
+ Count = count;
+ AfterID = afterID;
+ }
+
+ ///
+ /// Implicitly create a new pagination from a limit number.
+ ///
+ /// Set the value
+ /// A new instance
+ public static implicit operator Pagination(int limit) => new(limit);
+ }
+}
diff --git a/Kyoo.Abstractions/Models/Utils/Sort.cs b/Kyoo.Abstractions/Models/Utils/Sort.cs
new file mode 100644
index 00000000..00638559
--- /dev/null
+++ b/Kyoo.Abstractions/Models/Utils/Sort.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Linq.Expressions;
+using Kyoo.Utils;
+
+namespace Kyoo.Abstractions.Controllers
+{
+ ///
+ /// Information about how a query should be sorted. What factor should decide the sort and in which order.
+ ///
+ /// For witch type this sort applies
+ public readonly struct Sort
+ {
+ ///
+ /// The sort key. This member will be used to sort the results.
+ ///
+ public Expression> Key { get; }
+
+ ///
+ /// If this is set to true, items will be sorted in descend order else, they will be sorted in ascendant order.
+ ///
+ public bool Descendant { get; }
+
+ ///
+ /// Create a new instance.
+ ///
+ /// The sort key given. It is assigned to .
+ /// Should this be in descendant order? The default is false.
+ /// If the given key is not a member.
+ public Sort(Expression> key, bool descendant = false)
+ {
+ Key = key;
+ Descendant = descendant;
+
+ if (!Utility.IsPropertyExpression(Key))
+ throw new ArgumentException("The given sort key is not valid.");
+ }
+
+ ///
+ /// Create a new instance from a key's name (case insensitive).
+ ///
+ /// A key name with an optional order specifier. Format: "key:asc", "key:desc" or "key".
+ /// An invalid key or sort specifier as been given.
+ public Sort(string sortBy)
+ {
+ if (string.IsNullOrEmpty(sortBy))
+ {
+ Key = null;
+ Descendant = false;
+ return;
+ }
+
+ string key = sortBy.Contains(':') ? sortBy[..sortBy.IndexOf(':')] : sortBy;
+ string order = sortBy.Contains(':') ? sortBy[(sortBy.IndexOf(':') + 1)..] : null;
+
+ ParameterExpression param = Expression.Parameter(typeof(T), "x");
+ MemberExpression property = Expression.Property(param, key);
+ Key = property.Type.IsValueType
+ ? Expression.Lambda>(Expression.Convert(property, typeof(object)), param)
+ : Expression.Lambda>(property, param);
+
+ Descendant = order switch
+ {
+ "desc" => true,
+ "asc" => false,
+ null => false,
+ _ => throw new ArgumentException($"The sort order, if set, should be :asc or :desc but it was :{order}.")
+ };
+ }
+ }
+}
diff --git a/Kyoo.Authentication/AuthenticationModule.cs b/Kyoo.Authentication/AuthenticationModule.cs
index a75d3c9a..8cfbc5b5 100644
--- a/Kyoo.Authentication/AuthenticationModule.cs
+++ b/Kyoo.Authentication/AuthenticationModule.cs
@@ -10,7 +10,6 @@ using IdentityServer4.Models;
using IdentityServer4.Services;
using Kyoo.Abstractions;
using Kyoo.Abstractions.Controllers;
-using Kyoo.Abstractions.Models.Permissions;
using Kyoo.Authentication.Models;
using Kyoo.Authentication.Views;
using Microsoft.AspNetCore.Builder;
diff --git a/Kyoo.Authentication/Views/AccountApi.cs b/Kyoo.Authentication/Views/AccountApi.cs
index 513cb450..69887f31 100644
--- a/Kyoo.Authentication/Views/AccountApi.cs
+++ b/Kyoo.Authentication/Views/AccountApi.cs
@@ -104,6 +104,7 @@ namespace Kyoo.Authentication.Views
/// Login the user.
///
/// The DTO login request
+ /// TODO
[HttpPost("login")]
public async Task Login([FromBody] LoginRequest login)
{
@@ -122,6 +123,7 @@ namespace Kyoo.Authentication.Views
/// Use a OTAC to login a user.
///
/// The OTAC request
+ /// TODO
[HttpPost("otac-login")]
public async Task OtacLogin([FromBody] OtacRequest otac)
{
@@ -147,6 +149,7 @@ namespace Kyoo.Authentication.Views
///
/// Sign out an user
///
+ /// TODO
[HttpGet("logout")]
[Authorize]
public async Task Logout()
diff --git a/Kyoo.Core/Controllers/ConfigurationManager.cs b/Kyoo.Core/Controllers/ConfigurationManager.cs
index 8959abaa..66d54db2 100644
--- a/Kyoo.Core/Controllers/ConfigurationManager.cs
+++ b/Kyoo.Core/Controllers/ConfigurationManager.cs
@@ -168,7 +168,8 @@ namespace Kyoo.Core.Controllers
///
/// The configuration to transform
/// A strongly typed representation of the configuration.
- [SuppressMessage("ReSharper", "RedundantJumpStatement", Justification = "A catch block should not be empty.")]
+ [SuppressMessage("ReSharper", "RedundantJumpStatement",
+ Justification = "A catch block should not be empty.")]
private ExpandoObject _ToObject(IConfiguration config)
{
ExpandoObject obj = new();
diff --git a/Kyoo.Core/Controllers/Transcoder.cs b/Kyoo.Core/Controllers/Transcoder.cs
index ca5e1e9d..32c34a87 100644
--- a/Kyoo.Core/Controllers/Transcoder.cs
+++ b/Kyoo.Core/Controllers/Transcoder.cs
@@ -6,15 +6,12 @@ using Kyoo.Abstractions.Controllers;
using Kyoo.Abstractions.Models;
using Kyoo.Core.Models.Options;
using Microsoft.Extensions.Options;
-using Stream = Kyoo.Core.Models.Watch.Stream;
// We use threads so tasks are not always awaited.
#pragma warning disable 4014
namespace Kyoo.Core.Controllers
{
- public class BadTranscoderException : Exception { }
-
public class Transcoder : ITranscoder
{
private static class TranscoderAPI
@@ -83,6 +80,8 @@ namespace Kyoo.Core.Controllers
}
}
+ public class BadTranscoderException : Exception { }
+
private readonly IFileSystem _files;
private readonly IOptions _options;
private readonly Lazy _library;
diff --git a/Kyoo.Core/CoreModule.cs b/Kyoo.Core/CoreModule.cs
index 9dc2528f..ce5a064d 100644
--- a/Kyoo.Core/CoreModule.cs
+++ b/Kyoo.Core/CoreModule.cs
@@ -6,7 +6,6 @@ using Autofac.Core.Registration;
using Autofac.Extras.AttributeMetadata;
using Kyoo.Abstractions;
using Kyoo.Abstractions.Controllers;
-using Kyoo.Abstractions.Models.Permissions;
using Kyoo.Core.Api;
using Kyoo.Core.Controllers;
using Kyoo.Core.Models.Options;
diff --git a/Kyoo.Core/Models/Stream.cs b/Kyoo.Core/Models/Stream.cs
index 40f9ca44..7238d7c8 100644
--- a/Kyoo.Core/Models/Stream.cs
+++ b/Kyoo.Core/Models/Stream.cs
@@ -1,7 +1,5 @@
-using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using Kyoo.Abstractions.Models;
-using Kyoo.Abstractions.Models.Attributes;
namespace Kyoo.Core.Models.Watch
{
diff --git a/Kyoo.Core/Views/Helper/Serializers/JsonPropertyIgnorer.cs b/Kyoo.Core/Views/Helper/Serializers/JsonPropertyIgnorer.cs
index fe8a13e9..9fda1284 100644
--- a/Kyoo.Core/Views/Helper/Serializers/JsonPropertyIgnorer.cs
+++ b/Kyoo.Core/Views/Helper/Serializers/JsonPropertyIgnorer.cs
@@ -1,14 +1,10 @@
using System;
using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
using System.Reflection;
-using System.Text.RegularExpressions;
using Kyoo.Abstractions.Models;
using Kyoo.Abstractions.Models.Attributes;
using Kyoo.Utils;
using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
namespace Kyoo.Core.Api