new ordering system added

This commit is contained in:
2024-09-29 23:00:32 +02:00
Unverified
parent 69937f13e6
commit 450e4a2f94
19 changed files with 275 additions and 59 deletions

View File

@@ -1,13 +1,25 @@
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
using WatchIt.Common.Query;
using WatchIt.Database.Model.Media;
namespace WatchIt.Common.Model.Photos;
public class PhotoResponse : Photo
public class PhotoResponse : Photo, IQueryOrderable<PhotoResponse>
{
#region PROPERTIES
[JsonIgnore]
public static IDictionary<string, Func<PhotoResponse, IComparable>> OrderableProperties { get; } = new Dictionary<string, Func<PhotoResponse, IComparable>>
{
{ "id", x => x.Id },
{ "media_id", x => x.MediaId },
{ "mime_type", x => x.MimeType },
{ "is_background", x => x.Background is not null },
{ "is_universal_background", x => x.Background is not null && x.Background.IsUniversalBackground }
};
[JsonPropertyName("id")]
public Guid Id { get; set; }