diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
index 5095dfe4..2bbffa72 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
@@ -17,12 +17,9 @@
// along with Kyoo. If not, see .
using System;
-using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
-using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
-using Kyoo.Abstractions.Models.Attributes;
namespace Kyoo.Abstractions.Models;
@@ -49,9 +46,13 @@ public interface IThumbnails
}
[JsonConverter(typeof(ImageConvertor))]
-[SqlFirstColumn(nameof(Source))]
public class Image
{
+ ///
+ /// A unique identifier for the image. Used for proper http caches.
+ ///
+ public Guid Id { get; set; }
+
///
/// The original image from another server.
///
@@ -63,6 +64,21 @@ public class Image
[MaxLength(32)]
public string Blurhash { get; set; }
+ ///
+ /// The url to access the image in low quality.
+ ///
+ public string Low => $"/thumbnails/{Id}?quality=low";
+
+ ///
+ /// The url to access the image in medium quality.
+ ///
+ public string Medium => $"/thumbnails/{Id}?quality=medium";
+
+ ///
+ /// The url to access the image in high quality.
+ ///
+ public string High => $"/thumbnails/{Id}?quality=high";
+
public Image() { }
[JsonConstructor]
@@ -97,6 +113,9 @@ public class Image
writer.WriteStartObject();
writer.WriteString("source", value.Source);
writer.WriteString("blurhash", value.Blurhash);
+ writer.WriteString("low", value.Low);
+ writer.WriteString("medium", value.Medium);
+ writer.WriteString("high", value.High);
writer.WriteEndObject();
}
}
diff --git a/back/src/Kyoo.Abstractions/Utility/JsonKindResolver.cs b/back/src/Kyoo.Abstractions/Utility/JsonKindResolver.cs
index 45cdfdaa..db72f7e2 100644
--- a/back/src/Kyoo.Abstractions/Utility/JsonKindResolver.cs
+++ b/back/src/Kyoo.Abstractions/Utility/JsonKindResolver.cs
@@ -25,7 +25,6 @@ using System.Text.Json;
using System.Text.Json.Serialization.Metadata;
using Kyoo.Abstractions.Models;
using Kyoo.Abstractions.Models.Attributes;
-using Microsoft.AspNetCore.Http;
using static System.Text.Json.JsonNamingPolicy;
namespace Kyoo.Utils;
diff --git a/back/src/Kyoo.Core/Controllers/Repositories/DapperHelper.cs b/back/src/Kyoo.Core/Controllers/Repositories/DapperHelper.cs
index f98e84ce..19383169 100644
--- a/back/src/Kyoo.Core/Controllers/Repositories/DapperHelper.cs
+++ b/back/src/Kyoo.Core/Controllers/Repositories/DapperHelper.cs
@@ -252,7 +252,7 @@ public static class DapperHelper
this IDbConnection db,
FormattableString command,
Dictionary config,
- Func, T> mapper,
+ Func, T> mapper,
Func> get,
SqlVariableContext context,
Include? include,
@@ -327,23 +327,6 @@ public static class DapperHelper
? ExpendProjections(typeV, prefix, include)
: null;
- if (typeV.IsAssignableTo(typeof(IThumbnails)))
- {
- string posterProj = string.Join(
- ", ",
- new[] { "poster", "thumbnail", "logo" }.Select(x =>
- $"{prefix}{x}_source as source, {prefix}{x}_blurhash as blurhash"
- )
- );
- projection = string.IsNullOrEmpty(projection)
- ? posterProj
- : $"{projection}, {posterProj}";
- types.InsertRange(
- types.IndexOf(typeV) + 1,
- Enumerable.Repeat(typeof(Image), 3)
- );
- }
-
if (string.IsNullOrEmpty(projection))
return leadingComa;
return $", {projection}{leadingComa}";
@@ -355,19 +338,7 @@ public static class DapperHelper
types.ToArray(),
items =>
{
- List