new photos controller created

This commit is contained in:
2024-09-25 22:11:28 +02:00
Unverified
parent bb67186587
commit 9e9e5e1742
36 changed files with 743 additions and 332 deletions

View File

@@ -0,0 +1,47 @@
using Microsoft.AspNetCore.Mvc;
using WatchIt.Common.Model.Media;
using WatchIt.Common.Query;
namespace WatchIt.Common.Model.Photos;
public class PhotoQueryParameters : QueryParameters<PhotoResponse>
{
#region PROPERTIES
[FromQuery(Name = "mime_type")]
public string? MimeType { get; set; }
[FromQuery(Name = "is_background")]
public bool? IsBackground { get; set; }
[FromQuery(Name = "is_universal_background")]
public bool? IsUniversalBackground { get; set; }
[FromQuery(Name = "upload_date")]
public DateOnly? UploadDate { get; set; }
[FromQuery(Name = "upload_date_from")]
public DateOnly? UploadDateFrom { get; set; }
[FromQuery(Name = "upload_date_to")]
public DateOnly? UploadDateTo { get; set; }
#endregion
#region PUBLIC METHODS
public override bool IsMeetingConditions(PhotoResponse item) =>
(
TestString(item.MimeType, MimeType)
&&
TestBoolean(item.Background is not null, IsBackground)
&&
TestBoolean(item.Background!.IsUniversalBackground, IsUniversalBackground)
&&
TestComparable(item.UploadDate, UploadDate, UploadDateFrom, UploadDateTo)
);
#endregion
}