new ordering system added
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WatchIt.Common.Model.Media;
|
||||
using WatchIt.Common.Model.Series;
|
||||
using WatchIt.Common.Query;
|
||||
|
||||
namespace WatchIt.Common.Model.Photos;
|
||||
@@ -34,11 +36,11 @@ public class PhotoQueryParameters : QueryParameters<PhotoResponse>
|
||||
|
||||
public override bool IsMeetingConditions(PhotoResponse item) =>
|
||||
(
|
||||
TestString(item.MimeType, MimeType)
|
||||
TestStringWithRegex(item.MimeType, MimeType)
|
||||
&&
|
||||
TestBoolean(item.Background is not null, IsBackground)
|
||||
Test(item.Background is not null, IsBackground)
|
||||
&&
|
||||
TestBoolean(item.Background is not null && item.Background.IsUniversalBackground, IsUniversalBackground)
|
||||
Test(item.Background is not null && item.Background.IsUniversalBackground, IsUniversalBackground)
|
||||
&&
|
||||
TestComparable(item.UploadDate, UploadDate, UploadDateFrom, UploadDateTo)
|
||||
);
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user