new photos controller created
This commit is contained in:
@@ -1,18 +0,0 @@
|
|||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace WatchIt.Common.Model.Media;
|
|
||||||
|
|
||||||
public class MediaPhoto
|
|
||||||
{
|
|
||||||
[JsonPropertyName("media_id")]
|
|
||||||
public required long MediaId { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("image")]
|
|
||||||
public required byte[] Image { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("mime_type")]
|
|
||||||
public required string MimeType { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("background")]
|
|
||||||
public MediaPhotoBackground? Background { get; set; }
|
|
||||||
}
|
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
using WatchIt.Database.Model.Media;
|
using WatchIt.Common.Model.Photos;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
namespace WatchIt.Common.Model.Media;
|
namespace WatchIt.Common.Model.Media;
|
||||||
|
|
||||||
public class MediaPhotoRequest : MediaPhoto
|
public class MediaPhotoRequest : Photo
|
||||||
{
|
{
|
||||||
public MediaPhotoImage CreateMediaPhotoImage() => new MediaPhotoImage
|
public MediaPhotoImage CreateMediaPhotoImage(long mediaId) => new MediaPhotoImage
|
||||||
{
|
{
|
||||||
MediaId = MediaId,
|
MediaId = mediaId,
|
||||||
Image = Image,
|
Image = Image,
|
||||||
MimeType = MimeType
|
MimeType = MimeType
|
||||||
};
|
};
|
||||||
@@ -18,22 +19,4 @@ public class MediaPhotoRequest : MediaPhoto
|
|||||||
FirstGradientColor = Background.FirstGradientColor,
|
FirstGradientColor = Background.FirstGradientColor,
|
||||||
SecondGradientColor = Background.SecondGradientColor
|
SecondGradientColor = Background.SecondGradientColor
|
||||||
};
|
};
|
||||||
|
|
||||||
public void UpdateMediaPhotoImage(MediaPhotoImage item)
|
|
||||||
{
|
|
||||||
item.MediaId = MediaId;
|
|
||||||
item.Image = Image;
|
|
||||||
item.MimeType = MimeType;
|
|
||||||
item.UploadDate = DateTime.Now;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateMediaPhotoImageBackground(MediaPhotoImageBackground item)
|
|
||||||
{
|
|
||||||
if (Background is not null)
|
|
||||||
{
|
|
||||||
item.IsUniversalBackground = Background.IsUniversalBackground;
|
|
||||||
item.FirstGradientColor = Background.FirstGradientColor;
|
|
||||||
item.SecondGradientColor = Background.SecondGradientColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -2,20 +2,8 @@
|
|||||||
|
|
||||||
namespace WatchIt.Common.Model.Media;
|
namespace WatchIt.Common.Model.Media;
|
||||||
|
|
||||||
public abstract class MediaPoster
|
public abstract class MediaPoster : Picture
|
||||||
{
|
{
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
[JsonPropertyName("image")]
|
|
||||||
public required byte[] Image { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("mime_type")]
|
|
||||||
public required string MimeType { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
public override string ToString() => $"data:{MimeType};base64,{Convert.ToBase64String(Image)}";
|
public override string ToString() => $"data:{MimeType};base64,{Convert.ToBase64String(Image)}";
|
||||||
|
|||||||
13
WatchIt.Common/WatchIt.Common.Model/Photos/Photo.cs
Normal file
13
WatchIt.Common/WatchIt.Common.Model/Photos/Photo.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Photos;
|
||||||
|
|
||||||
|
public abstract class Photo : Picture
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
[JsonPropertyName("background")]
|
||||||
|
public PhotoBackgroundData? Background { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace WatchIt.Common.Model.Media;
|
namespace WatchIt.Common.Model.Photos;
|
||||||
|
|
||||||
public class MediaPhotoBackground
|
public class PhotoBackgroundData
|
||||||
{
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
[JsonPropertyName("is_universal_background")]
|
[JsonPropertyName("is_universal_background")]
|
||||||
public required bool IsUniversalBackground { get; set; }
|
public required bool IsUniversalBackground { get; set; }
|
||||||
|
|
||||||
@@ -12,4 +14,6 @@ public class MediaPhotoBackground
|
|||||||
|
|
||||||
[JsonPropertyName("second_gradient_color")]
|
[JsonPropertyName("second_gradient_color")]
|
||||||
public required byte[] SecondGradientColor { get; set; }
|
public required byte[] SecondGradientColor { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Photos;
|
||||||
|
|
||||||
|
public class PhotoBackgroundDataRequest : PhotoBackgroundData
|
||||||
|
{
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
public MediaPhotoImageBackground CreateMediaPhotoImageBackground(Guid photoId) => new MediaPhotoImageBackground
|
||||||
|
{
|
||||||
|
Id = photoId,
|
||||||
|
IsUniversalBackground = IsUniversalBackground,
|
||||||
|
FirstGradientColor = FirstGradientColor,
|
||||||
|
SecondGradientColor = SecondGradientColor,
|
||||||
|
};
|
||||||
|
|
||||||
|
public void UpdateMediaPhotoImageBackground(MediaPhotoImageBackground image)
|
||||||
|
{
|
||||||
|
image.IsUniversalBackground = IsUniversalBackground;
|
||||||
|
image.FirstGradientColor = FirstGradientColor;
|
||||||
|
image.SecondGradientColor = SecondGradientColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using System.Text;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WatchIt.Common.Model.Media;
|
||||||
using WatchIt.Common.Query;
|
using WatchIt.Common.Query;
|
||||||
|
|
||||||
namespace WatchIt.Common.Model.Media;
|
namespace WatchIt.Common.Model.Photos;
|
||||||
|
|
||||||
public class MediaPhotoQueryParameters : QueryParameters<MediaPhotoResponse>
|
public class PhotoQueryParameters : QueryParameters<PhotoResponse>
|
||||||
{
|
{
|
||||||
#region PROPERTIES
|
#region PROPERTIES
|
||||||
|
|
||||||
@@ -17,19 +17,30 @@ public class MediaPhotoQueryParameters : QueryParameters<MediaPhotoResponse>
|
|||||||
[FromQuery(Name = "is_universal_background")]
|
[FromQuery(Name = "is_universal_background")]
|
||||||
public bool? IsUniversalBackground { get; set; }
|
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
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
public override bool IsMeetingConditions(MediaPhotoResponse item) =>
|
public override bool IsMeetingConditions(PhotoResponse item) =>
|
||||||
(
|
(
|
||||||
TestString(item.MimeType, MimeType)
|
TestString(item.MimeType, MimeType)
|
||||||
&&
|
&&
|
||||||
TestBoolean(item.Background is not null, IsBackground)
|
TestBoolean(item.Background is not null, IsBackground)
|
||||||
&&
|
&&
|
||||||
TestBoolean(item.Background!.IsUniversalBackground, IsUniversalBackground)
|
TestBoolean(item.Background!.IsUniversalBackground, IsUniversalBackground)
|
||||||
|
&&
|
||||||
|
TestComparable(item.UploadDate, UploadDate, UploadDateFrom, UploadDateTo)
|
||||||
);
|
);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using WatchIt.Database.Model.Media;
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
namespace WatchIt.Common.Model.Media;
|
namespace WatchIt.Common.Model.Photos;
|
||||||
|
|
||||||
public class MediaPhotoResponse : MediaPhoto
|
public class PhotoResponse : Photo
|
||||||
{
|
{
|
||||||
#region PROPERTIES
|
#region PROPERTIES
|
||||||
|
|
||||||
[JsonPropertyName("id")]
|
[JsonPropertyName("id")]
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("media_id")]
|
||||||
|
public required long MediaId { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("upload_date")]
|
[JsonPropertyName("upload_date")]
|
||||||
public DateTime UploadDate { get; set; }
|
public DateTime UploadDate { get; set; }
|
||||||
|
|
||||||
@@ -21,10 +24,10 @@ public class MediaPhotoResponse : MediaPhoto
|
|||||||
#region CONSTRUCTORS
|
#region CONSTRUCTORS
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public MediaPhotoResponse() {}
|
public PhotoResponse() {}
|
||||||
|
|
||||||
[SetsRequiredMembers]
|
[SetsRequiredMembers]
|
||||||
public MediaPhotoResponse(MediaPhotoImage mediaPhotoImage)
|
public PhotoResponse(MediaPhotoImage mediaPhotoImage)
|
||||||
{
|
{
|
||||||
Id = mediaPhotoImage.Id;
|
Id = mediaPhotoImage.Id;
|
||||||
MediaId = mediaPhotoImage.MediaId;
|
MediaId = mediaPhotoImage.MediaId;
|
||||||
@@ -34,7 +37,7 @@ public class MediaPhotoResponse : MediaPhoto
|
|||||||
|
|
||||||
if (mediaPhotoImage.MediaPhotoImageBackground is not null)
|
if (mediaPhotoImage.MediaPhotoImageBackground is not null)
|
||||||
{
|
{
|
||||||
Background = new MediaPhotoBackground
|
Background = new PhotoBackgroundData
|
||||||
{
|
{
|
||||||
IsUniversalBackground = mediaPhotoImage.MediaPhotoImageBackground.IsUniversalBackground,
|
IsUniversalBackground = mediaPhotoImage.MediaPhotoImageBackground.IsUniversalBackground,
|
||||||
FirstGradientColor = mediaPhotoImage.MediaPhotoImageBackground.FirstGradientColor,
|
FirstGradientColor = mediaPhotoImage.MediaPhotoImageBackground.FirstGradientColor,
|
||||||
16
WatchIt.Common/WatchIt.Common.Model/Picture.cs
Normal file
16
WatchIt.Common/WatchIt.Common.Model/Picture.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model;
|
||||||
|
|
||||||
|
public abstract class Picture
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
[JsonPropertyName("image")]
|
||||||
|
public required byte[] Image { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("mime_type")]
|
||||||
|
public required string MimeType { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -4,33 +4,53 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using WatchIt.Common.Model.Genres;
|
using WatchIt.Common.Model.Genres;
|
||||||
using WatchIt.Common.Model.Media;
|
using WatchIt.Common.Model.Media;
|
||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
using WatchIt.WebAPI.Services.Controllers.Media;
|
using WatchIt.WebAPI.Services.Controllers.Media;
|
||||||
|
|
||||||
namespace WatchIt.WebAPI.Controllers;
|
namespace WatchIt.WebAPI.Controllers;
|
||||||
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("media")]
|
[Route("media")]
|
||||||
public class MediaController(IMediaControllerService mediaControllerService)
|
public class MediaController : ControllerBase
|
||||||
{
|
{
|
||||||
#region MAIN
|
#region FIELDS
|
||||||
|
|
||||||
[HttpGet("{id}")]
|
private readonly IMediaControllerService _mediaControllerService;
|
||||||
[AllowAnonymous]
|
|
||||||
[ProducesResponseType(typeof(MediaResponse), StatusCodes.Status200OK)]
|
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
||||||
public async Task<ActionResult> GetMedia([FromRoute] long id) => await mediaControllerService.GetMedia(id);
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region GENRES
|
#region CONSTRUCTORS
|
||||||
|
|
||||||
|
public MediaController(IMediaControllerService mediaControllerService)
|
||||||
|
{
|
||||||
|
_mediaControllerService = mediaControllerService;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region METHODS
|
||||||
|
|
||||||
|
#region Main
|
||||||
|
|
||||||
|
[HttpGet("{id}")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(typeof(MediaResponse), StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<ActionResult> GetMedia([FromRoute] long id) => await _mediaControllerService.GetMedia(id);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Genres
|
||||||
|
|
||||||
[HttpGet("{id}/genres")]
|
[HttpGet("{id}/genres")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(typeof(IEnumerable<GenreResponse>), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(IEnumerable<GenreResponse>), StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult> GetMediaGenres([FromRoute]long id) => await mediaControllerService.GetMediaGenres(id);
|
public async Task<ActionResult> GetMediaGenres([FromRoute]long id) => await _mediaControllerService.GetMediaGenres(id);
|
||||||
|
|
||||||
[HttpPost("{id}/genres/{genre_id}")]
|
[HttpPost("{id}/genres/{genre_id}")]
|
||||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||||
@@ -38,7 +58,7 @@ public class MediaController(IMediaControllerService mediaControllerService)
|
|||||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult> PostMediaGenre([FromRoute]long id, [FromRoute(Name = "genre_id")]short genreId) => await mediaControllerService.PostMediaGenre(id, genreId);
|
public async Task<ActionResult> PostMediaGenre([FromRoute]long id, [FromRoute(Name = "genre_id")]short genreId) => await _mediaControllerService.PostMediaGenre(id, genreId);
|
||||||
|
|
||||||
[HttpDelete("{id}/genres/{genre_id}")]
|
[HttpDelete("{id}/genres/{genre_id}")]
|
||||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||||
@@ -46,25 +66,23 @@ public class MediaController(IMediaControllerService mediaControllerService)
|
|||||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult> DeleteMediaGenre([FromRoute]long id, [FromRoute(Name = "genre_id")]short genreId) => await mediaControllerService.DeleteMediaGenre(id, genreId);
|
public async Task<ActionResult> DeleteMediaGenre([FromRoute]long id, [FromRoute(Name = "genre_id")]short genreId) => await _mediaControllerService.DeleteMediaGenre(id, genreId);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Rating
|
||||||
|
|
||||||
#region RATING
|
|
||||||
|
|
||||||
[HttpGet("{id}/rating")]
|
[HttpGet("{id}/rating")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(typeof(MediaRatingResponse), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(MediaRatingResponse), StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult> GetMediaRating([FromRoute] long id) => await mediaControllerService.GetMediaRating(id);
|
public async Task<ActionResult> GetMediaRating([FromRoute] long id) => await _mediaControllerService.GetMediaRating(id);
|
||||||
|
|
||||||
[HttpGet("{id}/rating/{user_id}")]
|
[HttpGet("{id}/rating/{user_id}")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(typeof(short), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(short), StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult> GetMediaRatingByUser([FromRoute] long id, [FromRoute(Name = "user_id")]long userId) => await mediaControllerService.GetMediaRatingByUser(id, userId);
|
public async Task<ActionResult> GetMediaRatingByUser([FromRoute] long id, [FromRoute(Name = "user_id")]long userId) => await _mediaControllerService.GetMediaRatingByUser(id, userId);
|
||||||
|
|
||||||
[HttpPut("{id}/rating")]
|
[HttpPut("{id}/rating")]
|
||||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||||
@@ -72,38 +90,34 @@ public class MediaController(IMediaControllerService mediaControllerService)
|
|||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult> PutMediaRating([FromRoute] long id, [FromBody] MediaRatingRequest data) => await mediaControllerService.PutMediaRating(id, data);
|
public async Task<ActionResult> PutMediaRating([FromRoute] long id, [FromBody] MediaRatingRequest data) => await _mediaControllerService.PutMediaRating(id, data);
|
||||||
|
|
||||||
[HttpDelete("{id}/rating")]
|
[HttpDelete("{id}/rating")]
|
||||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||||
public async Task<ActionResult> DeleteMediaRating([FromRoute] long id) => await mediaControllerService.DeleteMediaRating(id);
|
public async Task<ActionResult> DeleteMediaRating([FromRoute] long id) => await _mediaControllerService.DeleteMediaRating(id);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region View count
|
||||||
|
|
||||||
#region VIEW COUNT
|
|
||||||
|
|
||||||
[HttpPost("{id}/view")]
|
[HttpPost("{id}/view")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult> PostMediaView([FromRoute] long id) => await mediaControllerService.PostMediaView(id);
|
public async Task<ActionResult> PostMediaView([FromRoute] long id) => await _mediaControllerService.PostMediaView(id);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Poster
|
||||||
|
|
||||||
#region POSTER
|
|
||||||
|
|
||||||
[HttpGet("{id}/poster")]
|
[HttpGet("{id}/poster")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(typeof(MediaPosterResponse), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(MediaPosterResponse), StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult> GetMediaPoster([FromRoute] long id) => await mediaControllerService.GetMediaPoster(id);
|
public async Task<ActionResult> GetMediaPoster([FromRoute] long id) => await _mediaControllerService.GetMediaPoster(id);
|
||||||
|
|
||||||
[HttpPut("{id}/poster")]
|
[HttpPut("{id}/poster")]
|
||||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||||
@@ -111,68 +125,41 @@ public class MediaController(IMediaControllerService mediaControllerService)
|
|||||||
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||||
public async Task<ActionResult> PutMediaPoster([FromRoute]long id, [FromBody]MediaPosterRequest body) => await mediaControllerService.PutMediaPoster(id, body);
|
public async Task<ActionResult> PutMediaPoster([FromRoute]long id, [FromBody]MediaPosterRequest body) => await _mediaControllerService.PutMediaPoster(id, body);
|
||||||
|
|
||||||
[HttpDelete("{id}/poster")]
|
[HttpDelete("{id}/poster")]
|
||||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status204NoContent)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status204NoContent)]
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||||
public async Task<ActionResult> DeleteMediaPoster([FromRoute]long id) => await mediaControllerService.DeleteMediaPoster(id);
|
public async Task<ActionResult> DeleteMediaPoster([FromRoute]long id) => await _mediaControllerService.DeleteMediaPoster(id);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Photos
|
||||||
|
|
||||||
|
[HttpGet("{id}/photos")]
|
||||||
#region PHOTOS
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(typeof(IEnumerable<PhotoResponse>), StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<ActionResult> GetMediaPhotos([FromRoute]long id, PhotoQueryParameters query) => await _mediaControllerService.GetMediaPhotos(id, query);
|
||||||
|
|
||||||
[HttpGet("{id}/photos/random_background")]
|
[HttpGet("{id}/photos/random_background")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(typeof(MediaPhotoResponse), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(PhotoResponse), StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult> GetMediaPhotoRandomBackground([FromRoute]long id) => await mediaControllerService.GetMediaRandomBackgroundPhoto(id);
|
public async Task<ActionResult> GetMediaPhotoRandomBackground([FromRoute]long id) => await _mediaControllerService.GetMediaPhotoRandomBackground(id);
|
||||||
|
|
||||||
[HttpGet("photos/{photo_id}")]
|
[HttpPost("{id}/photos")]
|
||||||
[AllowAnonymous]
|
|
||||||
[ProducesResponseType(typeof(MediaPhotoResponse), StatusCodes.Status200OK)]
|
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
||||||
public async Task<ActionResult> GetPhoto([FromRoute(Name = "photo_id")] Guid photoId) => await mediaControllerService.GetPhoto(photoId);
|
|
||||||
|
|
||||||
[HttpGet("photos")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
[ProducesResponseType(typeof(IEnumerable<MediaPhotoResponse>), StatusCodes.Status200OK)]
|
|
||||||
public async Task<ActionResult> GetPhotos(MediaPhotoQueryParameters query) => await mediaControllerService.GetPhotos(query);
|
|
||||||
|
|
||||||
[HttpGet("photos/random_background")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
[ProducesResponseType(typeof(MediaPhotoResponse), StatusCodes.Status200OK)]
|
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
||||||
public async Task<ActionResult> GetPhotoRandomBackground() => await mediaControllerService.GetRandomBackgroundPhoto();
|
|
||||||
|
|
||||||
[HttpPost("photos")]
|
|
||||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||||
[ProducesResponseType(typeof(MediaPhotoResponse), StatusCodes.Status201Created)]
|
[ProducesResponseType(typeof(PhotoResponse), StatusCodes.Status201Created)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
|
||||||
public async Task<ActionResult> PostPhoto([FromBody]MediaPhotoRequest body) => await mediaControllerService.PostPhoto(body);
|
|
||||||
|
|
||||||
[HttpPut("photos/{photo_id}")]
|
|
||||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status200OK)]
|
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult> PutPhoto([FromRoute(Name = "photo_id")]Guid photoId, [FromBody]MediaPhotoRequest body) => await mediaControllerService.PutPhoto(photoId, body);
|
public async Task<ActionResult> PostPhoto([FromRoute]long id, [FromBody]MediaPhotoRequest body) => await _mediaControllerService.PostMediaPhoto(id, body);
|
||||||
|
|
||||||
[HttpDelete("photos/{photo_id}")]
|
#endregion
|
||||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status200OK)]
|
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
||||||
public async Task<ActionResult> DeletePhoto([FromRoute(Name = "photo_id")]Guid photoId) => await mediaControllerService.DeletePhoto(photoId);
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
|
using WatchIt.WebAPI.Services.Controllers.Photos;
|
||||||
|
|
||||||
|
namespace WatchIt.WebAPI.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[Route("photos")]
|
||||||
|
public class PhotosController : ControllerBase
|
||||||
|
{
|
||||||
|
#region FIELDS
|
||||||
|
|
||||||
|
private readonly IPhotosControllerService _photosControllerService;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region CONSTRUCTORS
|
||||||
|
|
||||||
|
public PhotosController(IPhotosControllerService photosControllerService)
|
||||||
|
{
|
||||||
|
_photosControllerService = photosControllerService;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region METHODS
|
||||||
|
|
||||||
|
#region Main
|
||||||
|
|
||||||
|
[HttpGet("random_background")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(typeof(PhotoResponse), StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<ActionResult> GetPhotoRandomBackground() => await _photosControllerService.GetPhotoRandomBackground();
|
||||||
|
|
||||||
|
[HttpDelete("{id}")]
|
||||||
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||||
|
[ProducesResponseType(typeof(void), StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<ActionResult> DeletePhoto([FromRoute] Guid id) => await _photosControllerService.DeletePhoto(id);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Background data
|
||||||
|
|
||||||
|
[HttpPut("{id}/background_data")]
|
||||||
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||||
|
[ProducesResponseType(typeof(void), StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<ActionResult> PutPhotoBackgroundData([FromRoute]Guid id, [FromBody] PhotoBackgroundDataRequest body) => await _photosControllerService.PutPhotoBackgroundData(id, body);
|
||||||
|
|
||||||
|
[HttpDelete("{id}/background_data")]
|
||||||
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||||
|
[ProducesResponseType(typeof(void), StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<ActionResult> DeletePhotoBackgroundData([FromRoute]Guid id) => await _photosControllerService.DeletePhotoBackgroundData(id);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Genres\WatchIt.WebAPI.Services.Controllers.Genres.csproj" />
|
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Genres\WatchIt.WebAPI.Services.Controllers.Genres.csproj" />
|
||||||
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Media\WatchIt.WebAPI.Services.Controllers.Media.csproj" />
|
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Media\WatchIt.WebAPI.Services.Controllers.Media.csproj" />
|
||||||
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Movies\WatchIt.WebAPI.Services.Controllers.Movies.csproj" />
|
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Movies\WatchIt.WebAPI.Services.Controllers.Movies.csproj" />
|
||||||
|
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Photos\WatchIt.WebAPI.Services.Controllers.Photos.csproj" />
|
||||||
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Series\WatchIt.WebAPI.Services.Controllers.Series.csproj" />
|
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Series\WatchIt.WebAPI.Services.Controllers.Series.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using WatchIt.Common.Model.Media;
|
using WatchIt.Common.Model.Media;
|
||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
using WatchIt.WebAPI.Services.Controllers.Common;
|
using WatchIt.WebAPI.Services.Controllers.Common;
|
||||||
|
|
||||||
namespace WatchIt.WebAPI.Services.Controllers.Media;
|
namespace WatchIt.WebAPI.Services.Controllers.Media;
|
||||||
@@ -22,11 +23,7 @@ public interface IMediaControllerService
|
|||||||
Task<RequestResult> PutMediaPoster(long mediaId, MediaPosterRequest data);
|
Task<RequestResult> PutMediaPoster(long mediaId, MediaPosterRequest data);
|
||||||
Task<RequestResult> DeleteMediaPoster(long mediaId);
|
Task<RequestResult> DeleteMediaPoster(long mediaId);
|
||||||
|
|
||||||
Task<RequestResult> GetPhoto(Guid id);
|
Task<RequestResult> GetMediaPhotos(long mediaId, PhotoQueryParameters queryParameters);
|
||||||
Task<RequestResult> GetPhotos(MediaPhotoQueryParameters query);
|
Task<RequestResult> GetMediaPhotoRandomBackground(long mediaId);
|
||||||
Task<RequestResult> GetRandomBackgroundPhoto();
|
Task<RequestResult> PostMediaPhoto(long mediaId, MediaPhotoRequest data);
|
||||||
Task<RequestResult> GetMediaRandomBackgroundPhoto(long id);
|
|
||||||
Task<RequestResult> PostPhoto(MediaPhotoRequest data);
|
|
||||||
Task<RequestResult> PutPhoto(Guid photoId, MediaPhotoRequest data);
|
|
||||||
Task<RequestResult> DeletePhoto(Guid photoId);
|
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using SimpleToolkit.Extensions;
|
using SimpleToolkit.Extensions;
|
||||||
using WatchIt.Common.Model.Genres;
|
using WatchIt.Common.Model.Genres;
|
||||||
using WatchIt.Common.Model.Media;
|
using WatchIt.Common.Model.Media;
|
||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
using WatchIt.Database;
|
using WatchIt.Database;
|
||||||
using WatchIt.Database.Model.Media;
|
using WatchIt.Database.Model.Media;
|
||||||
using WatchIt.Database.Model.Rating;
|
using WatchIt.Database.Model.Rating;
|
||||||
@@ -295,50 +296,33 @@ public class MediaControllerService(DatabaseContext database, IUserService userS
|
|||||||
|
|
||||||
#region Photos
|
#region Photos
|
||||||
|
|
||||||
public async Task<RequestResult> GetPhoto(Guid id)
|
public async Task<RequestResult> GetMediaPhotos(long mediaId, PhotoQueryParameters queryParameters)
|
||||||
{
|
{
|
||||||
MediaPhotoImage? item = await database.MediaPhotoImages.FirstOrDefaultAsync(x => x.Id == id);
|
Database.Model.Media.Media? media = await database.Media.FirstOrDefaultAsync(x => x.Id == mediaId);
|
||||||
if (item is null)
|
if (media is null)
|
||||||
{
|
{
|
||||||
return RequestResult.NotFound();
|
return RequestResult.NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaPhotoResponse data = new MediaPhotoResponse(item);
|
IEnumerable<MediaPhotoImage> imagesRaw = await database.MediaPhotoImages.Where(x => x.MediaId == mediaId).ToListAsync();
|
||||||
return RequestResult.Ok(data);
|
IEnumerable<PhotoResponse> images = imagesRaw.Select(x => new PhotoResponse(x));
|
||||||
|
images = queryParameters.PrepareData(images);
|
||||||
|
return RequestResult.Ok(images);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<RequestResult> GetPhotos(MediaPhotoQueryParameters query)
|
public Task<RequestResult> GetMediaPhotoRandomBackground(long mediaId)
|
||||||
{
|
{
|
||||||
IEnumerable<MediaPhotoResponse> data = await database.MediaPhotoImages.Select(x => new MediaPhotoResponse(x)).ToListAsync();
|
MediaPhotoImage? image = database.MediaPhotoImages.Where(x => x.MediaId == mediaId && x.MediaPhotoImageBackground != null).Random();
|
||||||
data = query.PrepareData(data);
|
|
||||||
return RequestResult.Ok(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<RequestResult> GetRandomBackgroundPhoto()
|
|
||||||
{
|
|
||||||
MediaPhotoImage? image = database.MediaPhotoImages.Where(x => x.MediaPhotoImageBackground != null && x.MediaPhotoImageBackground.IsUniversalBackground).Random();
|
|
||||||
if (image is null)
|
if (image is null)
|
||||||
{
|
{
|
||||||
return Task.FromResult<RequestResult>(RequestResult.NotFound());
|
return Task.FromResult<RequestResult>(RequestResult.NotFound());
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaPhotoResponse data = new MediaPhotoResponse(image);
|
PhotoResponse data = new PhotoResponse(image);
|
||||||
return Task.FromResult<RequestResult>(RequestResult.Ok(data));
|
return Task.FromResult<RequestResult>(RequestResult.Ok(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<RequestResult> GetMediaRandomBackgroundPhoto(long id)
|
public async Task<RequestResult> PostMediaPhoto(long mediaId, MediaPhotoRequest data)
|
||||||
{
|
|
||||||
MediaPhotoImage? image = database.MediaPhotoImages.Where(x => x.MediaId == id && x.MediaPhotoImageBackground != null).Random();
|
|
||||||
if (image is null)
|
|
||||||
{
|
|
||||||
return Task.FromResult<RequestResult>(RequestResult.NotFound());
|
|
||||||
}
|
|
||||||
|
|
||||||
MediaPhotoResponse data = new MediaPhotoResponse(image);
|
|
||||||
return Task.FromResult<RequestResult>(RequestResult.Ok(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<RequestResult> PostPhoto(MediaPhotoRequest data)
|
|
||||||
{
|
{
|
||||||
UserValidator validator = userService.GetValidator().MustBeAdmin();
|
UserValidator validator = userService.GetValidator().MustBeAdmin();
|
||||||
if (!validator.IsValid)
|
if (!validator.IsValid)
|
||||||
@@ -346,7 +330,13 @@ public class MediaControllerService(DatabaseContext database, IUserService userS
|
|||||||
return RequestResult.Forbidden();
|
return RequestResult.Forbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaPhotoImage item = data.CreateMediaPhotoImage();
|
Database.Model.Media.Media? media = await database.Media.FirstOrDefaultAsync(x => x.Id == mediaId);
|
||||||
|
if (media is null)
|
||||||
|
{
|
||||||
|
return RequestResult.NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
MediaPhotoImage item = data.CreateMediaPhotoImage(mediaId);
|
||||||
await database.MediaPhotoImages.AddAsync(item);
|
await database.MediaPhotoImages.AddAsync(item);
|
||||||
await database.SaveChangesAsync();
|
await database.SaveChangesAsync();
|
||||||
|
|
||||||
@@ -357,69 +347,7 @@ public class MediaControllerService(DatabaseContext database, IUserService userS
|
|||||||
await database.SaveChangesAsync();
|
await database.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
return RequestResult.Created($"photos/{item.Id}", new MediaPhotoResponse(item));
|
return RequestResult.Created($"photos/{item.Id}", new PhotoResponse(item));
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<RequestResult> PutPhoto(Guid photoId, MediaPhotoRequest data)
|
|
||||||
{
|
|
||||||
UserValidator validator = userService.GetValidator().MustBeAdmin();
|
|
||||||
if (!validator.IsValid)
|
|
||||||
{
|
|
||||||
return RequestResult.Forbidden();
|
|
||||||
}
|
|
||||||
|
|
||||||
MediaPhotoImage? item = await database.MediaPhotoImages.FirstOrDefaultAsync(x => x.Id == photoId);
|
|
||||||
if (item is null)
|
|
||||||
{
|
|
||||||
return RequestResult.NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
data.UpdateMediaPhotoImage(item);
|
|
||||||
if (item.MediaPhotoImageBackground is null && data.Background is not null)
|
|
||||||
{
|
|
||||||
MediaPhotoImageBackground background = data.CreateMediaPhotoImageBackground(item.Id)!;
|
|
||||||
await database.MediaPhotoImageBackgrounds.AddAsync(background);
|
|
||||||
}
|
|
||||||
else if (item.MediaPhotoImageBackground is not null && data.Background is null)
|
|
||||||
{
|
|
||||||
database.MediaPhotoImageBackgrounds.Attach(item.MediaPhotoImageBackground);
|
|
||||||
database.MediaPhotoImageBackgrounds.Remove(item.MediaPhotoImageBackground);
|
|
||||||
}
|
|
||||||
else if (item.MediaPhotoImageBackground is not null && data.Background is not null)
|
|
||||||
{
|
|
||||||
data.UpdateMediaPhotoImageBackground(item.MediaPhotoImageBackground);
|
|
||||||
}
|
|
||||||
await database.SaveChangesAsync();
|
|
||||||
|
|
||||||
return RequestResult.Ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<RequestResult> DeletePhoto(Guid photoId)
|
|
||||||
{
|
|
||||||
UserValidator validator = userService.GetValidator().MustBeAdmin();
|
|
||||||
if (!validator.IsValid)
|
|
||||||
{
|
|
||||||
return RequestResult.Forbidden();
|
|
||||||
}
|
|
||||||
|
|
||||||
MediaPhotoImage? item = await database.MediaPhotoImages.FirstOrDefaultAsync(x => x.Id == photoId);
|
|
||||||
if (item is null)
|
|
||||||
{
|
|
||||||
return RequestResult.NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.MediaPhotoImageBackground is not null)
|
|
||||||
{
|
|
||||||
database.MediaPhotoImageBackgrounds.Attach(item.MediaPhotoImageBackground);
|
|
||||||
database.MediaPhotoImageBackgrounds.Remove(item.MediaPhotoImageBackground);
|
|
||||||
await database.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
database.MediaPhotoImages.Attach(item);
|
|
||||||
database.MediaPhotoImages.Remove(item);
|
|
||||||
await database.SaveChangesAsync();
|
|
||||||
|
|
||||||
return RequestResult.Ok();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
|
using WatchIt.WebAPI.Services.Controllers.Common;
|
||||||
|
|
||||||
|
namespace WatchIt.WebAPI.Services.Controllers.Photos;
|
||||||
|
|
||||||
|
public interface IPhotosControllerService
|
||||||
|
{
|
||||||
|
Task<RequestResult> GetPhotoRandomBackground();
|
||||||
|
Task<RequestResult> DeletePhoto(Guid photoId);
|
||||||
|
|
||||||
|
Task<RequestResult> PutPhotoBackgroundData(Guid id, PhotoBackgroundDataRequest data);
|
||||||
|
Task<RequestResult> DeletePhotoBackgroundData(Guid id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SimpleToolkit.Extensions;
|
||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
|
using WatchIt.Database;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
using WatchIt.WebAPI.Services.Controllers.Common;
|
||||||
|
using WatchIt.WebAPI.Services.Utility.User;
|
||||||
|
|
||||||
|
namespace WatchIt.WebAPI.Services.Controllers.Photos;
|
||||||
|
|
||||||
|
public class PhotosControllerService : IPhotosControllerService
|
||||||
|
{
|
||||||
|
#region FIELDS
|
||||||
|
|
||||||
|
private readonly DatabaseContext _database;
|
||||||
|
private readonly IUserService _userService;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region CONTRUCTORS
|
||||||
|
|
||||||
|
public PhotosControllerService(DatabaseContext database, IUserService userService)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_userService = userService;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
#region Main
|
||||||
|
|
||||||
|
public Task<RequestResult> GetPhotoRandomBackground()
|
||||||
|
{
|
||||||
|
MediaPhotoImage? image = _database.MediaPhotoImages.Where(x => x.MediaPhotoImageBackground != null && x.MediaPhotoImageBackground.IsUniversalBackground).Random();
|
||||||
|
if (image is null)
|
||||||
|
{
|
||||||
|
return Task.FromResult<RequestResult>(RequestResult.NotFound());
|
||||||
|
}
|
||||||
|
|
||||||
|
PhotoResponse data = new PhotoResponse(image);
|
||||||
|
return Task.FromResult<RequestResult>(RequestResult.Ok(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<RequestResult> DeletePhoto(Guid photoId)
|
||||||
|
{
|
||||||
|
UserValidator validator = _userService.GetValidator().MustBeAdmin();
|
||||||
|
if (!validator.IsValid)
|
||||||
|
{
|
||||||
|
return RequestResult.Forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
MediaPhotoImage? item = await _database.MediaPhotoImages.FirstOrDefaultAsync(x => x.Id == photoId);
|
||||||
|
if (item is null)
|
||||||
|
{
|
||||||
|
return RequestResult.NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.MediaPhotoImageBackground is not null)
|
||||||
|
{
|
||||||
|
_database.MediaPhotoImageBackgrounds.Attach(item.MediaPhotoImageBackground);
|
||||||
|
_database.MediaPhotoImageBackgrounds.Remove(item.MediaPhotoImageBackground);
|
||||||
|
await _database.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
_database.MediaPhotoImages.Attach(item);
|
||||||
|
_database.MediaPhotoImages.Remove(item);
|
||||||
|
await _database.SaveChangesAsync();
|
||||||
|
|
||||||
|
return RequestResult.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Background data
|
||||||
|
|
||||||
|
public async Task<RequestResult> PutPhotoBackgroundData(Guid id, PhotoBackgroundDataRequest data)
|
||||||
|
{
|
||||||
|
UserValidator validator = _userService.GetValidator().MustBeAdmin();
|
||||||
|
if (!validator.IsValid)
|
||||||
|
{
|
||||||
|
return RequestResult.Forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
MediaPhotoImage? image = await _database.MediaPhotoImages.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (image is null)
|
||||||
|
{
|
||||||
|
return RequestResult.NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
MediaPhotoImageBackground? imageBackground = image.MediaPhotoImageBackground;
|
||||||
|
if (imageBackground is null)
|
||||||
|
{
|
||||||
|
imageBackground = data.CreateMediaPhotoImageBackground(id);
|
||||||
|
await _database.MediaPhotoImageBackgrounds.AddAsync(imageBackground);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data.UpdateMediaPhotoImageBackground(imageBackground);
|
||||||
|
}
|
||||||
|
await _database.SaveChangesAsync();
|
||||||
|
|
||||||
|
return RequestResult.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<RequestResult> DeletePhotoBackgroundData(Guid id)
|
||||||
|
{
|
||||||
|
UserValidator validator = _userService.GetValidator().MustBeAdmin();
|
||||||
|
if (!validator.IsValid)
|
||||||
|
{
|
||||||
|
return RequestResult.Forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
MediaPhotoImage? image = await _database.MediaPhotoImages.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (image is null)
|
||||||
|
{
|
||||||
|
return RequestResult.NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
MediaPhotoImageBackground? imageBackground = image.MediaPhotoImageBackground;
|
||||||
|
if (imageBackground is not null)
|
||||||
|
{
|
||||||
|
_database.MediaPhotoImageBackgrounds.Attach(imageBackground);
|
||||||
|
_database.MediaPhotoImageBackgrounds.Remove(imageBackground);
|
||||||
|
await _database.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
return RequestResult.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\..\WatchIt.Common\WatchIt.Common.Model\WatchIt.Common.Model.csproj" />
|
||||||
|
<ProjectReference Include="..\..\..\..\WatchIt.Database\WatchIt.Database\WatchIt.Database.csproj" />
|
||||||
|
<ProjectReference Include="..\..\WatchIt.WebAPI.Services.Utility\WatchIt.WebAPI.Services.Utility.User\WatchIt.WebAPI.Services.Utility.User.csproj" />
|
||||||
|
<ProjectReference Include="..\WatchIt.WebAPI.Services.Controllers.Common\WatchIt.WebAPI.Services.Controllers.Common.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="SimpleToolkit.Extensions" Version="1.7.7" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -9,7 +9,6 @@ public class MediaPhotoRequestValidator : AbstractValidator<MediaPhotoRequest>
|
|||||||
{
|
{
|
||||||
public MediaPhotoRequestValidator(DatabaseContext database)
|
public MediaPhotoRequestValidator(DatabaseContext database)
|
||||||
{
|
{
|
||||||
RuleFor(x => x.MediaId).MustBeIn(database.Media, x => x.Id).WithMessage("Media does not exists");
|
|
||||||
RuleFor(x => x.Image).NotEmpty();
|
RuleFor(x => x.Image).NotEmpty();
|
||||||
RuleFor(x => x.MimeType).Matches(@"\w+/.+").WithMessage("Incorrect mimetype");
|
RuleFor(x => x.MimeType).Matches(@"\w+/.+").WithMessage("Incorrect mimetype");
|
||||||
When(x => x.Background is not null, () =>
|
When(x => x.Background is not null, () =>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using WatchIt.WebAPI.Services.Controllers.Accounts;
|
|||||||
using WatchIt.WebAPI.Services.Controllers.Genres;
|
using WatchIt.WebAPI.Services.Controllers.Genres;
|
||||||
using WatchIt.WebAPI.Services.Controllers.Media;
|
using WatchIt.WebAPI.Services.Controllers.Media;
|
||||||
using WatchIt.WebAPI.Services.Controllers.Movies;
|
using WatchIt.WebAPI.Services.Controllers.Movies;
|
||||||
|
using WatchIt.WebAPI.Services.Controllers.Photos;
|
||||||
using WatchIt.WebAPI.Services.Controllers.Series;
|
using WatchIt.WebAPI.Services.Controllers.Series;
|
||||||
using WatchIt.WebAPI.Services.Utility.Configuration;
|
using WatchIt.WebAPI.Services.Utility.Configuration;
|
||||||
using WatchIt.WebAPI.Services.Utility.Tokens;
|
using WatchIt.WebAPI.Services.Utility.Tokens;
|
||||||
@@ -156,6 +157,7 @@ public static class Program
|
|||||||
builder.Services.AddTransient<IMoviesControllerService, MoviesControllerService>();
|
builder.Services.AddTransient<IMoviesControllerService, MoviesControllerService>();
|
||||||
builder.Services.AddTransient<IMediaControllerService, MediaControllerService>();
|
builder.Services.AddTransient<IMediaControllerService, MediaControllerService>();
|
||||||
builder.Services.AddTransient<ISeriesControllerService, SeriesControllerService>();
|
builder.Services.AddTransient<ISeriesControllerService, SeriesControllerService>();
|
||||||
|
builder.Services.AddTransient<IPhotosControllerService, PhotosControllerService>();
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ public class Endpoints
|
|||||||
public Media Media { get; set; }
|
public Media Media { get; set; }
|
||||||
public Movies Movies { get; set; }
|
public Movies Movies { get; set; }
|
||||||
public Series Series { get; set; }
|
public Series Series { get; set; }
|
||||||
|
public Photos Photos { get; set; }
|
||||||
}
|
}
|
||||||
@@ -3,23 +3,19 @@
|
|||||||
public class Media
|
public class Media
|
||||||
{
|
{
|
||||||
public string Base { get; set; }
|
public string Base { get; set; }
|
||||||
public string Get { get; set; }
|
public string GetMedia { get; set; }
|
||||||
public string GetGenres { get; set; }
|
public string GetMediaGenres { get; set; }
|
||||||
public string PostGenre { get; set; }
|
public string PostMediaGenre { get; set; }
|
||||||
public string DeleteGenre { get; set; }
|
public string DeleteMediaGenre { get; set; }
|
||||||
public string GetMediaRating { get; set; }
|
public string GetMediaRating { get; set; }
|
||||||
public string GetMediaRatingByUser { get; set; }
|
public string GetMediaRatingByUser { get; set; }
|
||||||
public string PutMediaRating { get; set; }
|
public string PutMediaRating { get; set; }
|
||||||
public string DeleteMediaRating { get; set; }
|
public string DeleteMediaRating { get; set; }
|
||||||
public string PostMediaView { get; set; }
|
public string PostMediaView { get; set; }
|
||||||
public string GetPhotoMediaRandomBackground { get; set; }
|
public string GetMediaPoster { get; set; }
|
||||||
public string GetPoster { get; set; }
|
public string PutMediaPoster { get; set; }
|
||||||
public string PutPoster { get; set; }
|
public string DeleteMediaPoster { get; set; }
|
||||||
public string DeletePoster { get; set; }
|
public string GetMediaPhotos { get; set; }
|
||||||
public string GetPhoto { get; set; }
|
public string GetMediaPhotoRandomBackground { get; set; }
|
||||||
public string GetPhotos { get; set; }
|
public string PostMediaPhoto { get; set; }
|
||||||
public string GetPhotoRandomBackground { get; set; }
|
|
||||||
public string PostPhoto { get; set; }
|
|
||||||
public string PutPhoto { get; set; }
|
|
||||||
public string DeletePhoto { get; set; }
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace WatchIt.Website.Services.Utility.Configuration.Model;
|
||||||
|
|
||||||
|
public class Photos
|
||||||
|
{
|
||||||
|
public string Base { get; set; }
|
||||||
|
public string GetPhotoRandomBackground { get; set; }
|
||||||
|
public string DeletePhoto { get; set; }
|
||||||
|
public string PutPhotoBackgroundData { get; set; }
|
||||||
|
public string DeletePhotoBackgroundData { get; set; }
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using WatchIt.Common.Model.Genres;
|
using WatchIt.Common.Model.Genres;
|
||||||
using WatchIt.Common.Model.Media;
|
using WatchIt.Common.Model.Media;
|
||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
|
|
||||||
namespace WatchIt.Website.Services.WebAPI.Media;
|
namespace WatchIt.Website.Services.WebAPI.Media;
|
||||||
|
|
||||||
@@ -9,6 +10,7 @@ public interface IMediaWebAPIService
|
|||||||
|
|
||||||
Task GetMediaGenres(long mediaId, Action<IEnumerable<GenreResponse>>? successAction = null, Action? notFoundAction = null);
|
Task GetMediaGenres(long mediaId, Action<IEnumerable<GenreResponse>>? successAction = null, Action? notFoundAction = null);
|
||||||
Task PostMediaGenre(long mediaId, long genreId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null);
|
Task PostMediaGenre(long mediaId, long genreId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null);
|
||||||
|
Task DeleteMediaGenre(long mediaId, long genreId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null);
|
||||||
|
|
||||||
Task GetMediaRating(long mediaId, Action<MediaRatingResponse>? successAction = null, Action? notFoundAction = null);
|
Task GetMediaRating(long mediaId, Action<MediaRatingResponse>? successAction = null, Action? notFoundAction = null);
|
||||||
Task GetMediaRatingByUser(long mediaId, long userId, Action<short>? successAction = null, Action? notFoundAction = null);
|
Task GetMediaRatingByUser(long mediaId, long userId, Action<short>? successAction = null, Action? notFoundAction = null);
|
||||||
@@ -17,9 +19,11 @@ public interface IMediaWebAPIService
|
|||||||
|
|
||||||
Task PostMediaView(long mediaId, Action? successAction = null, Action? notFoundAction = null);
|
Task PostMediaView(long mediaId, Action? successAction = null, Action? notFoundAction = null);
|
||||||
|
|
||||||
Task GetPhotoMediaRandomBackground(long mediaId, Action<MediaPhotoResponse>? successAction = null, Action? notFoundAction = null);
|
Task GetMediaPoster(long mediaId, Action<MediaPosterResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? notFoundAction = null);
|
||||||
Task GetPhotoRandomBackground(Action<MediaPhotoResponse>? successAction = null, Action? notFoundAction = null);
|
Task PutMediaPoster(long mediaId, MediaPosterRequest data, Action<MediaPosterResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null);
|
||||||
Task GetPoster(long mediaId, Action<MediaPosterResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? notFoundAction = null);
|
Task DeleteMediaPoster(long mediaId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null);
|
||||||
Task PutPoster(long mediaId, MediaPosterRequest data, Action<MediaPosterResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null);
|
|
||||||
Task DeletePoster(long mediaId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null);
|
Task GetMediaPhotos(long mediaId, PhotoQueryParameters? query = null, Action<IEnumerable<PhotoResponse>>? successAction = null, Action? notFoundAction = null);
|
||||||
|
Task GetMediaPhotoRandomBackground(long mediaId, Action<PhotoResponse>? successAction = null, Action? notFoundAction = null);
|
||||||
|
Task PostMediaPhoto(long mediaId, MediaPhotoRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using WatchIt.Common.Model.Genres;
|
using WatchIt.Common.Model.Genres;
|
||||||
using WatchIt.Common.Model.Media;
|
using WatchIt.Common.Model.Media;
|
||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
using WatchIt.Common.Services.HttpClient;
|
using WatchIt.Common.Services.HttpClient;
|
||||||
using WatchIt.Website.Services.Utility.Configuration;
|
using WatchIt.Website.Services.Utility.Configuration;
|
||||||
using WatchIt.Website.Services.Utility.Configuration.Model;
|
using WatchIt.Website.Services.Utility.Configuration.Model;
|
||||||
@@ -7,19 +8,38 @@ using WatchIt.Website.Services.WebAPI.Common;
|
|||||||
|
|
||||||
namespace WatchIt.Website.Services.WebAPI.Media;
|
namespace WatchIt.Website.Services.WebAPI.Media;
|
||||||
|
|
||||||
public class MediaWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService) : BaseWebAPIService(configurationService), IMediaWebAPIService
|
public class MediaWebAPIService : BaseWebAPIService, IMediaWebAPIService
|
||||||
{
|
{
|
||||||
|
#region FIELDS
|
||||||
|
|
||||||
|
private readonly IHttpClientService _httpClientService;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region CONSTRUCTORS
|
||||||
|
|
||||||
|
public MediaWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService)
|
||||||
|
{
|
||||||
|
_httpClientService = httpClientService;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
#region Main
|
#region Main
|
||||||
|
|
||||||
public async Task GetMedia(long mediaId, Action<MediaResponse>? successAction = null, Action? notFoundAction = null)
|
public async Task GetMedia(long mediaId, Action<MediaResponse>? successAction = null, Action? notFoundAction = null)
|
||||||
{
|
{
|
||||||
string url = GetUrl(EndpointsConfiguration.Media.Get, mediaId);
|
string url = GetUrl(EndpointsConfiguration.Media.GetMedia, mediaId);
|
||||||
|
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
.RegisterActionFor404NotFound(notFoundAction)
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
.ExecuteAction();
|
.ExecuteAction();
|
||||||
@@ -31,11 +51,11 @@ public class MediaWebAPIService(IHttpClientService httpClientService, IConfigura
|
|||||||
|
|
||||||
public async Task GetMediaGenres(long mediaId, Action<IEnumerable<GenreResponse>>? successAction = null, Action? notFoundAction = null)
|
public async Task GetMediaGenres(long mediaId, Action<IEnumerable<GenreResponse>>? successAction = null, Action? notFoundAction = null)
|
||||||
{
|
{
|
||||||
string url = GetUrl(EndpointsConfiguration.Media.GetGenres, mediaId);
|
string url = GetUrl(EndpointsConfiguration.Media.GetMediaGenres, mediaId);
|
||||||
|
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
.RegisterActionFor404NotFound(notFoundAction)
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
.ExecuteAction();
|
.ExecuteAction();
|
||||||
@@ -43,11 +63,25 @@ public class MediaWebAPIService(IHttpClientService httpClientService, IConfigura
|
|||||||
|
|
||||||
public async Task PostMediaGenre(long mediaId, long genreId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null)
|
public async Task PostMediaGenre(long mediaId, long genreId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null)
|
||||||
{
|
{
|
||||||
string url = GetUrl(EndpointsConfiguration.Media.PostGenre, mediaId, genreId);
|
string url = GetUrl(EndpointsConfiguration.Media.PostMediaGenre, mediaId, genreId);
|
||||||
|
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
HttpRequest request = new HttpRequest(HttpMethodType.Post, url);
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
||||||
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
||||||
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
|
.ExecuteAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DeleteMediaGenre(long mediaId, long genreId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null)
|
||||||
|
{
|
||||||
|
string url = GetUrl(EndpointsConfiguration.Media.DeleteMediaGenre, mediaId, genreId);
|
||||||
|
|
||||||
|
HttpRequest request = new HttpRequest(HttpMethodType.Delete, url);
|
||||||
|
|
||||||
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
||||||
.RegisterActionFor403Forbidden(forbiddenAction)
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
||||||
@@ -65,7 +99,7 @@ public class MediaWebAPIService(IHttpClientService httpClientService, IConfigura
|
|||||||
|
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
.RegisterActionFor404NotFound(notFoundAction)
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
.ExecuteAction();
|
.ExecuteAction();
|
||||||
@@ -77,7 +111,7 @@ public class MediaWebAPIService(IHttpClientService httpClientService, IConfigura
|
|||||||
|
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
.RegisterActionFor404NotFound(notFoundAction)
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
.ExecuteAction();
|
.ExecuteAction();
|
||||||
@@ -92,7 +126,7 @@ public class MediaWebAPIService(IHttpClientService httpClientService, IConfigura
|
|||||||
Body = body
|
Body = body
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
.RegisterActionFor400BadRequest(badRequestAction)
|
.RegisterActionFor400BadRequest(badRequestAction)
|
||||||
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
||||||
@@ -106,7 +140,7 @@ public class MediaWebAPIService(IHttpClientService httpClientService, IConfigura
|
|||||||
|
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Delete, url);
|
HttpRequest request = new HttpRequest(HttpMethodType.Delete, url);
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
||||||
.ExecuteAction();
|
.ExecuteAction();
|
||||||
@@ -122,7 +156,7 @@ public class MediaWebAPIService(IHttpClientService httpClientService, IConfigura
|
|||||||
|
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Post, url);
|
HttpRequest request = new HttpRequest(HttpMethodType.Post, url);
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
.RegisterActionFor404NotFound(notFoundAction)
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
.ExecuteAction();
|
.ExecuteAction();
|
||||||
@@ -130,55 +164,31 @@ public class MediaWebAPIService(IHttpClientService httpClientService, IConfigura
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Poster
|
||||||
|
|
||||||
|
public async Task GetMediaPoster(long mediaId, Action<MediaPosterResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? notFoundAction = null)
|
||||||
public async Task GetPhotoMediaRandomBackground(long mediaId, Action<MediaPhotoResponse>? successAction = null, Action? notFoundAction = null)
|
|
||||||
{
|
{
|
||||||
string url = GetUrl(EndpointsConfiguration.Media.GetPhotoMediaRandomBackground, mediaId);
|
string url = GetUrl(EndpointsConfiguration.Media.GetMediaPoster, mediaId);
|
||||||
|
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
|
||||||
.RegisterActionFor404NotFound(notFoundAction)
|
|
||||||
.ExecuteAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task GetPhotoRandomBackground(Action<MediaPhotoResponse>? successAction = null, Action? notFoundAction = null)
|
|
||||||
{
|
|
||||||
string url = GetUrl(EndpointsConfiguration.Media.GetPhotoRandomBackground);
|
|
||||||
|
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
|
||||||
.RegisterActionFor404NotFound(notFoundAction)
|
|
||||||
.ExecuteAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task GetPoster(long mediaId, Action<MediaPosterResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? notFoundAction = null)
|
|
||||||
{
|
|
||||||
string url = GetUrl(EndpointsConfiguration.Media.GetPoster, mediaId);
|
|
||||||
|
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
.RegisterActionFor400BadRequest(badRequestAction)
|
.RegisterActionFor400BadRequest(badRequestAction)
|
||||||
.RegisterActionFor404NotFound(notFoundAction)
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
.ExecuteAction();
|
.ExecuteAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task PutPoster(long mediaId, MediaPosterRequest data, Action<MediaPosterResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null)
|
public async Task PutMediaPoster(long mediaId, MediaPosterRequest data, Action<MediaPosterResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null)
|
||||||
{
|
{
|
||||||
string url = GetUrl(EndpointsConfiguration.Media.PutPoster, mediaId);
|
string url = GetUrl(EndpointsConfiguration.Media.PutMediaPoster, mediaId);
|
||||||
|
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Put, url)
|
HttpRequest request = new HttpRequest(HttpMethodType.Put, url)
|
||||||
{
|
{
|
||||||
Body = data
|
Body = data
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
.RegisterActionFor400BadRequest(badRequestAction)
|
.RegisterActionFor400BadRequest(badRequestAction)
|
||||||
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
||||||
@@ -186,13 +196,13 @@ public class MediaWebAPIService(IHttpClientService httpClientService, IConfigura
|
|||||||
.ExecuteAction();
|
.ExecuteAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeletePoster(long mediaId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null)
|
public async Task DeleteMediaPoster(long mediaId, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null)
|
||||||
{
|
{
|
||||||
string url = GetUrl(EndpointsConfiguration.Media.DeletePoster, mediaId);
|
string url = GetUrl(EndpointsConfiguration.Media.DeleteMediaPoster, mediaId);
|
||||||
|
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Delete, url);
|
HttpRequest request = new HttpRequest(HttpMethodType.Delete, url);
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
response.RegisterActionFor2XXSuccess(successAction)
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
||||||
.RegisterActionFor403Forbidden(forbiddenAction)
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
||||||
@@ -201,6 +211,51 @@ public class MediaWebAPIService(IHttpClientService httpClientService, IConfigura
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Photos
|
||||||
|
|
||||||
|
public async Task GetMediaPhotos(long mediaId, PhotoQueryParameters? query = null, Action<IEnumerable<PhotoResponse>>? successAction = null, Action? notFoundAction = null)
|
||||||
|
{
|
||||||
|
string url = GetUrl(EndpointsConfiguration.Media.GetMediaPhotos, mediaId);
|
||||||
|
|
||||||
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
||||||
|
|
||||||
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
|
.ExecuteAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task GetMediaPhotoRandomBackground(long mediaId, Action<PhotoResponse>? successAction = null, Action? notFoundAction = null)
|
||||||
|
{
|
||||||
|
string url = GetUrl(EndpointsConfiguration.Media.GetMediaPhotoRandomBackground, mediaId);
|
||||||
|
|
||||||
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
||||||
|
|
||||||
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
|
.ExecuteAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task PostMediaPhoto(long mediaId, MediaPhotoRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null)
|
||||||
|
{
|
||||||
|
string url = GetUrl(EndpointsConfiguration.Media.PostMediaPhoto, mediaId);
|
||||||
|
|
||||||
|
HttpRequest request = new HttpRequest(HttpMethodType.Post, url);
|
||||||
|
|
||||||
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
|
.RegisterActionFor400BadRequest(badRequestAction)
|
||||||
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
||||||
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
||||||
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
|
.ExecuteAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PRIVATE METHODS
|
#region PRIVATE METHODS
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
|
|
||||||
|
namespace WatchIt.Website.Services.WebAPI.Photos;
|
||||||
|
|
||||||
|
public interface IPhotosWebAPIService
|
||||||
|
{
|
||||||
|
Task GetPhotoRandomBackground(Action<PhotoResponse>? successAction = null, Action? notFoundAction = null);
|
||||||
|
Task DeletePhoto(Guid id, Action<PhotoResponse>? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null);
|
||||||
|
Task PutPhotoBackgroundData(Guid id, PhotoBackgroundDataRequest data, Action<PhotoResponse>? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null);
|
||||||
|
Task DeletePhotoBackgroundData(Guid id, Action<PhotoResponse>? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null);
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
|
using WatchIt.Common.Services.HttpClient;
|
||||||
|
using WatchIt.Website.Services.Utility.Configuration;
|
||||||
|
using WatchIt.Website.Services.WebAPI.Common;
|
||||||
|
|
||||||
|
namespace WatchIt.Website.Services.WebAPI.Photos;
|
||||||
|
|
||||||
|
public class PhotosWebAPIService : BaseWebAPIService, IPhotosWebAPIService
|
||||||
|
{
|
||||||
|
#region FIELDS
|
||||||
|
|
||||||
|
private readonly IHttpClientService _httpClientService;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region CONSTRUCTORS
|
||||||
|
|
||||||
|
public PhotosWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService)
|
||||||
|
{
|
||||||
|
_httpClientService = httpClientService;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
#region Main
|
||||||
|
|
||||||
|
public async Task GetPhotoRandomBackground(Action<PhotoResponse>? successAction = null, Action? notFoundAction = null)
|
||||||
|
{
|
||||||
|
string url = GetUrl(EndpointsConfiguration.Photos.GetPhotoRandomBackground);
|
||||||
|
|
||||||
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
||||||
|
|
||||||
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
|
.ExecuteAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DeletePhoto(Guid id, Action<PhotoResponse>? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null)
|
||||||
|
{
|
||||||
|
string url = GetUrl(EndpointsConfiguration.Photos.DeletePhoto, id);
|
||||||
|
|
||||||
|
HttpRequest request = new HttpRequest(HttpMethodType.Delete, url);
|
||||||
|
|
||||||
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
||||||
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
||||||
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
|
.ExecuteAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Background data
|
||||||
|
|
||||||
|
public async Task PutPhotoBackgroundData(Guid id, PhotoBackgroundDataRequest data, Action<PhotoResponse>? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null)
|
||||||
|
{
|
||||||
|
string url = GetUrl(EndpointsConfiguration.Photos.PutPhotoBackgroundData, id);
|
||||||
|
|
||||||
|
HttpRequest request = new HttpRequest(HttpMethodType.Put, url)
|
||||||
|
{
|
||||||
|
Body = data
|
||||||
|
};
|
||||||
|
|
||||||
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
||||||
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
||||||
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
|
.ExecuteAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DeletePhotoBackgroundData(Guid id, Action<PhotoResponse>? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null)
|
||||||
|
{
|
||||||
|
string url = GetUrl(EndpointsConfiguration.Photos.DeletePhotoBackgroundData, id);
|
||||||
|
|
||||||
|
HttpRequest request = new HttpRequest(HttpMethodType.Delete, url);
|
||||||
|
|
||||||
|
HttpResponse response = await _httpClientService.SendRequestAsync(request);
|
||||||
|
response.RegisterActionFor2XXSuccess(successAction)
|
||||||
|
.RegisterActionFor401Unauthorized(unauthorizedAction)
|
||||||
|
.RegisterActionFor403Forbidden(forbiddenAction)
|
||||||
|
.RegisterActionFor404NotFound(notFoundAction)
|
||||||
|
.ExecuteAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PRIVATE METHODS
|
||||||
|
|
||||||
|
protected override string GetServiceBase() => EndpointsConfiguration.Photos.Base;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\..\WatchIt.Common\WatchIt.Common.Services\WatchIt.Common.Services.HttpClient\WatchIt.Common.Services.HttpClient.csproj" />
|
||||||
|
<ProjectReference Include="..\..\WatchIt.Website.Services.Utility\WatchIt.Website.Services.Utility.Configuration\WatchIt.Website.Services.Utility.Configuration.csproj" />
|
||||||
|
<ProjectReference Include="..\WatchIt.Website.Services.WebAPI.Common\WatchIt.Website.Services.WebAPI.Common.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
@inherits LayoutComponentBase
|
@using WatchIt.Common.Model.Photos
|
||||||
|
@using WatchIt.Website.Services.WebAPI.Photos
|
||||||
|
@inherits LayoutComponentBase
|
||||||
|
|
||||||
@if (_loaded)
|
@if (_loaded)
|
||||||
{
|
{
|
||||||
@@ -87,6 +89,7 @@
|
|||||||
[Inject] public IAuthenticationService AuthenticationService { get; set; } = default!;
|
[Inject] public IAuthenticationService AuthenticationService { get; set; } = default!;
|
||||||
[Inject] public IAccountsWebAPIService AccountsWebAPIService { get; set; } = default!;
|
[Inject] public IAccountsWebAPIService AccountsWebAPIService { get; set; } = default!;
|
||||||
[Inject] public IMediaWebAPIService MediaWebAPIService { get; set; } = default!;
|
[Inject] public IMediaWebAPIService MediaWebAPIService { get; set; } = default!;
|
||||||
|
[Inject] public IPhotosWebAPIService PhotosWebAPIService { get; set; } = default!;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -134,7 +137,7 @@
|
|||||||
|
|
||||||
private async Task GetBackground()
|
private async Task GetBackground()
|
||||||
{
|
{
|
||||||
Action<MediaPhotoResponse> backgroundSuccess = (data) =>
|
Action<PhotoResponse> backgroundSuccess = (data) =>
|
||||||
{
|
{
|
||||||
string imageBase64 = Convert.ToBase64String(data.Image);
|
string imageBase64 = Convert.ToBase64String(data.Image);
|
||||||
string firstColor = BitConverter.ToString(data.Background.FirstGradientColor)
|
string firstColor = BitConverter.ToString(data.Background.FirstGradientColor)
|
||||||
@@ -146,7 +149,7 @@
|
|||||||
_firstGradientColor = $"#{firstColor}";
|
_firstGradientColor = $"#{firstColor}";
|
||||||
_secondGradientColor = $"#{secondColor}";
|
_secondGradientColor = $"#{secondColor}";
|
||||||
};
|
};
|
||||||
await MediaWebAPIService.GetPhotoRandomBackground(backgroundSuccess);
|
await PhotosWebAPIService.GetPhotoRandomBackground(backgroundSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task GetAuthenticatedUser()
|
private async Task GetAuthenticatedUser()
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using WatchIt.Common.Model.Accounts;
|
using WatchIt.Common.Model.Accounts;
|
||||||
using WatchIt.Common.Model.Media;
|
using WatchIt.Common.Model.Media;
|
||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
using WatchIt.Website.Services.Utility.Authentication;
|
using WatchIt.Website.Services.Utility.Authentication;
|
||||||
using WatchIt.Website.Services.Utility.Tokens;
|
using WatchIt.Website.Services.Utility.Tokens;
|
||||||
using WatchIt.Website.Services.WebAPI.Accounts;
|
using WatchIt.Website.Services.WebAPI.Accounts;
|
||||||
using WatchIt.Website.Services.WebAPI.Media;
|
using WatchIt.Website.Services.WebAPI.Media;
|
||||||
|
using WatchIt.Website.Services.WebAPI.Photos;
|
||||||
|
|
||||||
namespace WatchIt.Website.Pages;
|
namespace WatchIt.Website.Pages;
|
||||||
|
|
||||||
@@ -17,6 +19,7 @@ public partial class AuthPage
|
|||||||
[Inject] public ITokensService TokensService { get; set; } = default!;
|
[Inject] public ITokensService TokensService { get; set; } = default!;
|
||||||
[Inject] public IMediaWebAPIService MediaWebAPIService { get; set; } = default!;
|
[Inject] public IMediaWebAPIService MediaWebAPIService { get; set; } = default!;
|
||||||
[Inject] public IAccountsWebAPIService AccountsWebAPIService { get; set; } = default!;
|
[Inject] public IAccountsWebAPIService AccountsWebAPIService { get; set; } = default!;
|
||||||
|
[Inject] public IPhotosWebAPIService PhotosWebAPIService { get; set; } = default!;
|
||||||
[Inject] public NavigationManager NavigationManager { get; set; } = default!;
|
[Inject] public NavigationManager NavigationManager { get; set; } = default!;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -75,7 +78,7 @@ public partial class AuthPage
|
|||||||
NavigationManager.NavigateTo("/");
|
NavigationManager.NavigateTo("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
Action<MediaPhotoResponse> backgroundSuccess = (data) =>
|
Action<PhotoResponse> backgroundSuccess = (data) =>
|
||||||
{
|
{
|
||||||
string imageBase64 = Convert.ToBase64String(data.Image);
|
string imageBase64 = Convert.ToBase64String(data.Image);
|
||||||
string firstColor = BitConverter.ToString(data.Background.FirstGradientColor)
|
string firstColor = BitConverter.ToString(data.Background.FirstGradientColor)
|
||||||
@@ -87,7 +90,7 @@ public partial class AuthPage
|
|||||||
_firstGradientColor = $"#{firstColor}";
|
_firstGradientColor = $"#{firstColor}";
|
||||||
_secondGradientColor = $"#{secondColor}";
|
_secondGradientColor = $"#{secondColor}";
|
||||||
};
|
};
|
||||||
await MediaWebAPIService.GetPhotoRandomBackground(backgroundSuccess);
|
await PhotosWebAPIService.GetPhotoRandomBackground(backgroundSuccess);
|
||||||
|
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ public partial class HomePage
|
|||||||
await Task.WhenAll(step1Tasks);
|
await Task.WhenAll(step1Tasks);
|
||||||
endTasks.AddRange(
|
endTasks.AddRange(
|
||||||
[
|
[
|
||||||
Parallel.ForEachAsync(_topMovies, async (x, _) => await MediaWebAPIService.GetPoster(x.Key.Id, y => _topMovies[x.Key] = y)),
|
Parallel.ForEachAsync(_topMovies, async (x, _) => await MediaWebAPIService.GetMediaPoster(x.Key.Id, y => _topMovies[x.Key] = y)),
|
||||||
Parallel.ForEachAsync(_topSeries, async (x, _) => await MediaWebAPIService.GetPoster(x.Key.Id, y => _topSeries[x.Key] = y))
|
Parallel.ForEachAsync(_topSeries, async (x, _) => await MediaWebAPIService.GetMediaPoster(x.Key.Id, y => _topSeries[x.Key] = y))
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// END
|
// END
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ using Microsoft.AspNetCore.Components;
|
|||||||
using Microsoft.AspNetCore.Components.Forms;
|
using Microsoft.AspNetCore.Components.Forms;
|
||||||
using WatchIt.Common.Model.Media;
|
using WatchIt.Common.Model.Media;
|
||||||
using WatchIt.Common.Model.Movies;
|
using WatchIt.Common.Model.Movies;
|
||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
using WatchIt.Common.Model.Series;
|
using WatchIt.Common.Model.Series;
|
||||||
using WatchIt.Website.Services.Utility.Authentication;
|
using WatchIt.Website.Services.Utility.Authentication;
|
||||||
using WatchIt.Website.Services.WebAPI.Media;
|
using WatchIt.Website.Services.WebAPI.Media;
|
||||||
using WatchIt.Website.Services.WebAPI.Movies;
|
using WatchIt.Website.Services.WebAPI.Movies;
|
||||||
|
using WatchIt.Website.Services.WebAPI.Photos;
|
||||||
using WatchIt.Website.Services.WebAPI.Series;
|
using WatchIt.Website.Services.WebAPI.Series;
|
||||||
|
|
||||||
namespace WatchIt.Website.Pages;
|
namespace WatchIt.Website.Pages;
|
||||||
@@ -41,7 +43,7 @@ public partial class MediaEditPage : ComponentBase
|
|||||||
|
|
||||||
private User? _user;
|
private User? _user;
|
||||||
|
|
||||||
private MediaPhotoResponse? _background;
|
private PhotoResponse? _background;
|
||||||
|
|
||||||
private MediaResponse? _media;
|
private MediaResponse? _media;
|
||||||
private MovieRequest? _movieRequest;
|
private MovieRequest? _movieRequest;
|
||||||
@@ -94,8 +96,8 @@ public partial class MediaEditPage : ComponentBase
|
|||||||
{
|
{
|
||||||
endTasks.AddRange(
|
endTasks.AddRange(
|
||||||
[
|
[
|
||||||
MediaWebAPIService.GetPhotoMediaRandomBackground(Id.Value, data => _background = data),
|
MediaWebAPIService.GetMediaPhotoRandomBackground(Id.Value, data => _background = data),
|
||||||
MediaWebAPIService.GetPoster(Id.Value, data =>
|
MediaWebAPIService.GetMediaPoster(Id.Value, data =>
|
||||||
{
|
{
|
||||||
_mediaPosterSaved = data;
|
_mediaPosterSaved = data;
|
||||||
_mediaPosterRequest = new MediaPosterRequest(data);
|
_mediaPosterRequest = new MediaPosterRequest(data);
|
||||||
@@ -179,7 +181,7 @@ public partial class MediaEditPage : ComponentBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mediaPosterSaving = true;
|
_mediaPosterSaving = true;
|
||||||
await MediaWebAPIService.PutPoster(Id.Value, _mediaPosterRequest, Success);
|
await MediaWebAPIService.PutMediaPoster(Id.Value, _mediaPosterRequest, Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CancelPoster()
|
private void CancelPoster()
|
||||||
@@ -199,7 +201,7 @@ public partial class MediaEditPage : ComponentBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mediaPosterDeleting = true;
|
_mediaPosterDeleting = true;
|
||||||
await MediaWebAPIService.DeletePoster(Id.Value, Success);
|
await MediaWebAPIService.DeleteMediaPoster(Id.Value, Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Components;
|
|||||||
using WatchIt.Common.Model.Genres;
|
using WatchIt.Common.Model.Genres;
|
||||||
using WatchIt.Common.Model.Media;
|
using WatchIt.Common.Model.Media;
|
||||||
using WatchIt.Common.Model.Movies;
|
using WatchIt.Common.Model.Movies;
|
||||||
|
using WatchIt.Common.Model.Photos;
|
||||||
using WatchIt.Common.Model.Series;
|
using WatchIt.Common.Model.Series;
|
||||||
using WatchIt.Website.Services.Utility.Authentication;
|
using WatchIt.Website.Services.Utility.Authentication;
|
||||||
using WatchIt.Website.Services.WebAPI.Media;
|
using WatchIt.Website.Services.WebAPI.Media;
|
||||||
@@ -42,7 +43,7 @@ public partial class MediaPage : ComponentBase
|
|||||||
|
|
||||||
private User? _user;
|
private User? _user;
|
||||||
|
|
||||||
private MediaPhotoResponse? _background;
|
private PhotoResponse? _background;
|
||||||
private MediaPosterResponse? _poster;
|
private MediaPosterResponse? _poster;
|
||||||
private IEnumerable<GenreResponse> _genres;
|
private IEnumerable<GenreResponse> _genres;
|
||||||
private MediaRatingResponse _globalRating;
|
private MediaRatingResponse _globalRating;
|
||||||
@@ -83,8 +84,8 @@ public partial class MediaPage : ComponentBase
|
|||||||
endTasks.AddRange(
|
endTasks.AddRange(
|
||||||
[
|
[
|
||||||
MediaWebAPIService.PostMediaView(Id),
|
MediaWebAPIService.PostMediaView(Id),
|
||||||
MediaWebAPIService.GetPhotoMediaRandomBackground(Id, data => _background = data),
|
MediaWebAPIService.GetMediaPhotoRandomBackground(Id, data => _background = data),
|
||||||
MediaWebAPIService.GetPoster(Id, data => _poster = data),
|
MediaWebAPIService.GetMediaPoster(Id, data => _poster = data),
|
||||||
MediaWebAPIService.GetMediaGenres(Id, data => _genres = data),
|
MediaWebAPIService.GetMediaGenres(Id, data => _genres = data),
|
||||||
MediaWebAPIService.GetMediaRating(Id, data => _globalRating = data),
|
MediaWebAPIService.GetMediaRating(Id, data => _globalRating = data),
|
||||||
_media.Type == MediaType.Movie ? MoviesWebAPIService.GetMovie(Id, data => _movie = data) : SeriesWebAPIService.GetSeries(Id, data => _series = data),
|
_media.Type == MediaType.Movie ? MoviesWebAPIService.GetMovie(Id, data => _movie = data) : SeriesWebAPIService.GetSeries(Id, data => _series = data),
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using WatchIt.Website.Services.Utility.Tokens;
|
|||||||
using WatchIt.Website.Services.WebAPI.Accounts;
|
using WatchIt.Website.Services.WebAPI.Accounts;
|
||||||
using WatchIt.Website.Services.WebAPI.Media;
|
using WatchIt.Website.Services.WebAPI.Media;
|
||||||
using WatchIt.Website.Services.WebAPI.Movies;
|
using WatchIt.Website.Services.WebAPI.Movies;
|
||||||
|
using WatchIt.Website.Services.WebAPI.Photos;
|
||||||
using WatchIt.Website.Services.WebAPI.Series;
|
using WatchIt.Website.Services.WebAPI.Series;
|
||||||
|
|
||||||
namespace WatchIt.Website;
|
namespace WatchIt.Website;
|
||||||
@@ -64,6 +65,7 @@ public static class Program
|
|||||||
builder.Services.AddSingleton<IMediaWebAPIService, MediaWebAPIService>();
|
builder.Services.AddSingleton<IMediaWebAPIService, MediaWebAPIService>();
|
||||||
builder.Services.AddSingleton<IMoviesWebAPIService, MoviesWebAPIService>();
|
builder.Services.AddSingleton<IMoviesWebAPIService, MoviesWebAPIService>();
|
||||||
builder.Services.AddSingleton<ISeriesWebAPIService, SeriesWebAPIService>();
|
builder.Services.AddSingleton<ISeriesWebAPIService, SeriesWebAPIService>();
|
||||||
|
builder.Services.AddSingleton<IPhotosWebAPIService, PhotosWebAPIService>();
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
<ProjectReference Include="..\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Accounts\WatchIt.Website.Services.WebAPI.Accounts.csproj" />
|
<ProjectReference Include="..\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Accounts\WatchIt.Website.Services.WebAPI.Accounts.csproj" />
|
||||||
<ProjectReference Include="..\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Media\WatchIt.Website.Services.WebAPI.Media.csproj" />
|
<ProjectReference Include="..\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Media\WatchIt.Website.Services.WebAPI.Media.csproj" />
|
||||||
<ProjectReference Include="..\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Movies\WatchIt.Website.Services.WebAPI.Movies.csproj" />
|
<ProjectReference Include="..\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Movies\WatchIt.Website.Services.WebAPI.Movies.csproj" />
|
||||||
|
<ProjectReference Include="..\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Photos\WatchIt.Website.Services.WebAPI.Photos.csproj" />
|
||||||
<ProjectReference Include="..\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Series\WatchIt.Website.Services.WebAPI.Series.csproj" />
|
<ProjectReference Include="..\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Series\WatchIt.Website.Services.WebAPI.Series.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -30,26 +30,21 @@
|
|||||||
},
|
},
|
||||||
"Media": {
|
"Media": {
|
||||||
"Base": "/media",
|
"Base": "/media",
|
||||||
"Get": "/{0}",
|
"GetMedia": "/{0}",
|
||||||
"GetGenres": "/{0}/genres",
|
"GetMediaGenres": "/{0}/genres",
|
||||||
"PostGenre": "/{0}/genres/{1}",
|
"PostMediaGenre": "/{0}/genres/{1}",
|
||||||
"DeleteGenre": "/{0}/genres/{1}",
|
"DeleteMediaGenre": "/{0}/genres/{1}",
|
||||||
"GetMediaRating": "/{0}/rating",
|
"GetMediaRating": "/{0}/rating",
|
||||||
"GetMediaRatingByUser": "/{0}/rating/{1}",
|
"GetMediaRatingByUser": "/{0}/rating/{1}",
|
||||||
"PutMediaRating": "/{0}/rating",
|
"PutMediaRating": "/{0}/rating",
|
||||||
"DeleteMediaRating": "/{0}/rating",
|
"DeleteMediaRating": "/{0}/rating",
|
||||||
"PostMediaView": "/{0}/view",
|
"PostMediaView": "/{0}/view",
|
||||||
|
"GetMediaPoster": "/{0}/poster",
|
||||||
"GetPhotoMediaRandomBackground": "/{0}/photos/random_background",
|
"PutMediaPoster": "/{0}/poster",
|
||||||
"GetPoster": "/{0}/poster",
|
"DeleteMediaPoster": "/{0}/poster",
|
||||||
"PutPoster": "/{0}/poster",
|
"GetMediaPhotos": "/{0}/photos",
|
||||||
"DeletePoster": "/{0}/poster",
|
"GetMediaPhotoRandomBackground": "/{0}/photos/random_background",
|
||||||
"GetPhoto": "/photos/{0}",
|
"PostMediaPhoto": "/{0}/photos"
|
||||||
"GetPhotos": "/photos",
|
|
||||||
"GetPhotoRandomBackground": "/photos/random_background",
|
|
||||||
"PostPhoto": "/photos",
|
|
||||||
"PutPhoto": "/photos/{0}",
|
|
||||||
"DeletePhoto": "/photos/{0}"
|
|
||||||
},
|
},
|
||||||
"Movies": {
|
"Movies": {
|
||||||
"Base": "/movies",
|
"Base": "/movies",
|
||||||
@@ -68,6 +63,13 @@
|
|||||||
"PutSeries": "/{0}",
|
"PutSeries": "/{0}",
|
||||||
"DeleteSeries": "/{0}",
|
"DeleteSeries": "/{0}",
|
||||||
"GetSeriesViewRank": "/view"
|
"GetSeriesViewRank": "/view"
|
||||||
|
},
|
||||||
|
"Photos": {
|
||||||
|
"Base": "/photos",
|
||||||
|
"GetPhotoRandomBackground": "/random_background",
|
||||||
|
"DeletePhoto": "/{0}",
|
||||||
|
"PutPhotoBackgroundData": "/{0}/background_data",
|
||||||
|
"DeletePhotoBackgroundData": "/{0}/background_data"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
WatchIt.sln
14
WatchIt.sln
@@ -84,6 +84,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Con
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Series", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Series\WatchIt.Website.Services.WebAPI.Series.csproj", "{783C743A-85BF-4382-BFE5-7A90E3F3B8B6}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Series", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Series\WatchIt.Website.Services.WebAPI.Series.csproj", "{783C743A-85BF-4382-BFE5-7A90E3F3B8B6}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Photos", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Photos\WatchIt.WebAPI.Services.Controllers.Photos.csproj", "{ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Photos", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Photos\WatchIt.Website.Services.WebAPI.Photos.csproj", "{960A833F-C195-4D1D-AD4F-D00B57067181}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -128,6 +132,8 @@ Global
|
|||||||
{8720AECA-7084-429A-BA15-49B6622C1A32} = {130BC8F5-82CE-4EDF-AECB-21594DD41849}
|
{8720AECA-7084-429A-BA15-49B6622C1A32} = {130BC8F5-82CE-4EDF-AECB-21594DD41849}
|
||||||
{F8FCEF7B-72EA-48BC-AC68-E11244B067DD} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7}
|
{F8FCEF7B-72EA-48BC-AC68-E11244B067DD} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7}
|
||||||
{783C743A-85BF-4382-BFE5-7A90E3F3B8B6} = {46E3711F-18BD-4004-AF53-EA4D8643D92F}
|
{783C743A-85BF-4382-BFE5-7A90E3F3B8B6} = {46E3711F-18BD-4004-AF53-EA4D8643D92F}
|
||||||
|
{ABDF8471-2FAB-4930-B016-7DD3E48AE6B8} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7}
|
||||||
|
{960A833F-C195-4D1D-AD4F-D00B57067181} = {46E3711F-18BD-4004-AF53-EA4D8643D92F}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{23383776-1F27-4B5D-8C7C-57BFF75FA473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{23383776-1F27-4B5D-8C7C-57BFF75FA473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
@@ -250,5 +256,13 @@ Global
|
|||||||
{783C743A-85BF-4382-BFE5-7A90E3F3B8B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{783C743A-85BF-4382-BFE5-7A90E3F3B8B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{783C743A-85BF-4382-BFE5-7A90E3F3B8B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{783C743A-85BF-4382-BFE5-7A90E3F3B8B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{783C743A-85BF-4382-BFE5-7A90E3F3B8B6}.Release|Any CPU.Build.0 = Release|Any CPU
|
{783C743A-85BF-4382-BFE5-7A90E3F3B8B6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{960A833F-C195-4D1D-AD4F-D00B57067181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{960A833F-C195-4D1D-AD4F-D00B57067181}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{960A833F-C195-4D1D-AD4F-D00B57067181}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{960A833F-C195-4D1D-AD4F-D00B57067181}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
Reference in New Issue
Block a user