MediaEditPage - photos management panel added

This commit is contained in:
2024-09-27 01:05:06 +02:00
Unverified
parent d02207a335
commit b56261b672
18 changed files with 403 additions and 19 deletions

View File

@@ -1,10 +1,28 @@
using WatchIt.Common.Model.Photos;
using System.Diagnostics.CodeAnalysis;
using WatchIt.Common.Model.Photos;
using WatchIt.Database.Model.Media;
namespace WatchIt.Common.Model.Media;
public class MediaPhotoRequest : Photo
{
#region CONSTRUCTORS
public MediaPhotoRequest() {}
[SetsRequiredMembers]
public MediaPhotoRequest(PhotoResponse response)
{
Image = response.Image;
MimeType = response.MimeType;
}
#endregion
#region PUBLIC METHODS
public MediaPhotoImage CreateMediaPhotoImage(long mediaId) => new MediaPhotoImage
{
MediaId = mediaId,
@@ -19,4 +37,6 @@ public class MediaPhotoRequest : Photo
FirstGradientColor = Background.FirstGradientColor,
SecondGradientColor = Background.SecondGradientColor
};
#endregion
}

View File

@@ -4,9 +4,4 @@ namespace WatchIt.Common.Model.Media;
public abstract class MediaPoster : Picture
{
#region PUBLIC METHODS
public override string ToString() => $"data:{MimeType};base64,{Convert.ToBase64String(Image)}";
#endregion
}

View File

@@ -1,9 +1,26 @@
using System.Diagnostics.CodeAnalysis;
using WatchIt.Database.Model.Media;
namespace WatchIt.Common.Model.Photos;
public class PhotoBackgroundDataRequest : PhotoBackgroundData
{
#region CONSTRUCTORS
public PhotoBackgroundDataRequest() {}
[SetsRequiredMembers]
public PhotoBackgroundDataRequest(PhotoBackgroundData photoBackgroundData)
{
IsUniversalBackground = photoBackgroundData.IsUniversalBackground;
FirstGradientColor = photoBackgroundData.FirstGradientColor;
SecondGradientColor = photoBackgroundData.SecondGradientColor;
}
#endregion
#region PUBLIC METHODS
public MediaPhotoImageBackground CreateMediaPhotoImageBackground(Guid photoId) => new MediaPhotoImageBackground

View File

@@ -38,7 +38,7 @@ public class PhotoQueryParameters : QueryParameters<PhotoResponse>
&&
TestBoolean(item.Background is not null, IsBackground)
&&
TestBoolean(item.Background!.IsUniversalBackground, IsUniversalBackground)
TestBoolean(item.Background is not null && item.Background.IsUniversalBackground, IsUniversalBackground)
&&
TestComparable(item.UploadDate, UploadDate, UploadDateFrom, UploadDateTo)
);

View File

@@ -13,4 +13,12 @@ public abstract class Picture
public required string MimeType { get; set; }
#endregion
#region PUBLIC METHODS
public override string ToString() => $"data:{MimeType};base64,{Convert.ToBase64String(Image)}";
#endregion
}