diff --git a/Kyoo.Common/Controllers/IRepository.cs b/Kyoo.Common/Controllers/IRepository.cs
index f7be69ad..a83d17fa 100644
--- a/Kyoo.Common/Controllers/IRepository.cs
+++ b/Kyoo.Common/Controllers/IRepository.cs
@@ -128,6 +128,7 @@ namespace Kyoo.Controllers
/// The id of the resource
/// If the item could not be found.
/// The resource found
+ [ItemNotNull]
Task Get(int id);
///
/// Get a resource from it's slug.
@@ -135,6 +136,7 @@ namespace Kyoo.Controllers
/// The slug of the resource
/// If the item could not be found.
/// The resource found
+ [ItemNotNull]
Task Get(string slug);
///
/// Get the first resource that match the predicate.
@@ -142,6 +144,7 @@ namespace Kyoo.Controllers
/// A predicate to filter the resource.
/// If the item could not be found.
/// The resource found
+ [ItemNotNull]
Task Get(Expression> where);
///
@@ -149,18 +152,21 @@ namespace Kyoo.Controllers
///
/// The id of the resource
/// The resource found
+ [ItemCanBeNull]
Task GetOrDefault(int id);
///
/// Get a resource from it's slug or null if it is not found.
///
/// The slug of the resource
/// The resource found
+ [ItemCanBeNull]
Task GetOrDefault(string slug);
///
/// Get the first resource that match the predicate or null if it is not found.
///
/// A predicate to filter the resource.
/// The resource found
+ [ItemCanBeNull]
Task GetOrDefault(Expression> where);
///
@@ -168,6 +174,7 @@ namespace Kyoo.Controllers
///
/// The query string.
/// A list of resources found
+ [ItemNotNull]
Task> Search(string query);
///
@@ -177,6 +184,7 @@ namespace Kyoo.Controllers
/// Sort information about the query (sort by, sort order)
/// How pagination should be done (where to start and how many to return)
/// A list of resources that match every filters
+ [ItemNotNull]
Task> GetAll(Expression> where = null,
Sort sort = default,
Pagination limit = default);
@@ -187,6 +195,7 @@ namespace Kyoo.Controllers
/// A sort by predicate. The order is ascending.
/// How pagination should be done (where to start and how many to return)
/// A list of resources that match every filters
+ [ItemNotNull]
Task> GetAll([Optional] Expression> where,
Expression> sort,
Pagination limit = default
@@ -205,6 +214,7 @@ namespace Kyoo.Controllers
///
/// The item to register
/// The resource registers and completed by database's information (related items & so on)
+ [ItemNotNull]
Task Create([NotNull] T obj);
///
@@ -212,6 +222,7 @@ namespace Kyoo.Controllers
///
/// The object to create
/// The newly created item or the existing value if it existed.
+ [ItemNotNull]
Task CreateIfNotExists([NotNull] T obj);
///
@@ -221,6 +232,7 @@ namespace Kyoo.Controllers
/// Should old properties of the resource be discarded or should null values considered as not changed?
/// If the item is not found
/// The resource edited and completed by database's information (related items & so on)
+ [ItemNotNull]
Task Edit([NotNull] T edited, bool resetOld);
///
diff --git a/Kyoo.CommonAPI/CrudApi.cs b/Kyoo.CommonAPI/CrudApi.cs
index 336d3226..a6834c31 100644
--- a/Kyoo.CommonAPI/CrudApi.cs
+++ b/Kyoo.CommonAPI/CrudApi.cs
@@ -38,7 +38,7 @@ namespace Kyoo.CommonApi
[PartialPermission(Kind.Read)]
public virtual async Task> Get(string slug)
{
- T ret = await _repository.Get(slug);
+ T ret = await _repository.GetOrDefault(slug);
if (ret == null)
return NotFound();
return ret;