mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 17:11:10 +00:00
Adds media library cover image
This commit is contained in:
1 parent
89debaeaad
commit
666a739b1d
43 files changed
+1170
-94
No files matched your search
+1
-5
@@ -8,8 +8,6 @@ using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Security.Claims;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
@@ -50,9 +48,7 @@ public class AddLibraryEndpoint : BaseEndpoint<AddLibraryRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(AddLibraryRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
// retrieve the currently authenticated user, and send it with the request // TODO: replace with current user service
|
||||
string? user = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
ErrorOr<LibraryResponse> result = await _sender.Send(request.ToCommand(Guid.Parse(user!)), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<LibraryResponse> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Created($"{BaseURL}api/v1{ApiRoutes.Libraries.ADD_LIBRARY}/{result.Value.Id}", result.Value), Problem);
|
||||
}
|
||||
}
|
||||
+8
-3
@@ -30,18 +30,21 @@ public class AddLibraryEndpointSummary : Summary<AddLibraryEndpoint, AddLibraryR
|
||||
ContentLocations: [
|
||||
"/media/tv shows/drama/",
|
||||
"/media/tv shows/SCI-FI/",
|
||||
]
|
||||
],
|
||||
CoverImage: "/media/posters/myPoster.jpg"
|
||||
);
|
||||
|
||||
RequestParam(r => r.Title, "The title of the media library. Required.");
|
||||
RequestParam(r => r.LibraryType, "The type of the media library. Required.");
|
||||
RequestParam(r => r.ContentLocations, ">The file system paths of the directories where the media library elements are located. Required.");
|
||||
RequestParam(r => r.ContentLocations, "The file system paths of the directories where the media library elements are located. Required.");
|
||||
RequestParam(r => r.CoverImage, "The path of the image file used as the cover for the library. Optional.");
|
||||
|
||||
ResponseParam<LibraryResponse>(r => r.Id, "The unique identifier of the entity.");
|
||||
ResponseParam<LibraryResponse>(r => r.UserId, "The Id of the user owning the media library.");
|
||||
ResponseParam<LibraryResponse>(r => r.Title, "The title of the media library.");
|
||||
ResponseParam<LibraryResponse>(r => r.LibraryType, "The type of the media library.");
|
||||
ResponseParam<LibraryResponse>(r => r.ContentLocations, "The file system paths of the directories where the media library elements are located.");
|
||||
ResponseParam<LibraryResponse>(r => r.CoverImage, "The path of the image file used as the cover for the library.");
|
||||
ResponseParam<LibraryResponse>(r => r.CreatedOnUtc, "The date and time when the entity was created.");
|
||||
ResponseParam<LibraryResponse>(r => r.UpdatedOnUtc, "The date and time when the entity was last updated.");
|
||||
|
||||
@@ -53,6 +56,7 @@ public class AddLibraryEndpointSummary : Summary<AddLibraryEndpoint, AddLibraryR
|
||||
Title: "TV Shows",
|
||||
LibraryType: LibraryType.TvShow,
|
||||
ContentLocations: ["/media/tv shows/drama/", "/media/tv shows/SCI-FI/"],
|
||||
CoverImage: "/media/myPoster.jpg",
|
||||
CreatedOnUtc: DateTime.UtcNow,
|
||||
UpdatedOnUtc: default
|
||||
));
|
||||
@@ -108,7 +112,8 @@ public class AddLibraryEndpointSummary : Summary<AddLibraryEndpoint, AddLibraryR
|
||||
"PathsListCannotBeEmpty",
|
||||
"PathCannotBeEmpty",
|
||||
"TitleCannotBeEmpty",
|
||||
"TitleMustBeMaximum255CharactersLong"
|
||||
"TitleMustBeMaximum255CharactersLong",
|
||||
"CoverFileMustBeAnImage"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+2
-1
@@ -35,6 +35,7 @@ public class GetLibraryEndpointSummary : Summary<GetLibraryEndpoint, GetLibraryR
|
||||
ResponseParam<LibraryResponse>(r => r.Title, "The title of the media library.");
|
||||
ResponseParam<LibraryResponse>(r => r.LibraryType, "The type of the media library.");
|
||||
ResponseParam<LibraryResponse>(r => r.ContentLocations, "The file system paths of the directories where the media library elements are located.");
|
||||
ResponseParam<LibraryResponse>(r => r.CoverImage, "The path of the image file used as the cover for the library.");
|
||||
ResponseParam<LibraryResponse>(r => r.CreatedOnUtc, "The date and time when the entity was created.");
|
||||
ResponseParam<LibraryResponse>(r => r.UpdatedOnUtc, "The date and time when the entity was last updated.");
|
||||
|
||||
@@ -44,6 +45,7 @@ public class GetLibraryEndpointSummary : Summary<GetLibraryEndpoint, GetLibraryR
|
||||
Title: "TV Shows",
|
||||
LibraryType: LibraryType.TvShow,
|
||||
ContentLocations: ["/media/tv shows/drama/", "/media/tv shows/SCI-FI/"],
|
||||
CoverImage: "/media/myPoster.jpg",
|
||||
CreatedOnUtc: DateTime.UtcNow,
|
||||
UpdatedOnUtc: default
|
||||
));
|
||||
@@ -124,6 +126,5 @@ public class GetLibraryEndpointSummary : Summary<GetLibraryEndpoint, GetLibraryR
|
||||
traceId = "00-2470be4248a2a5a0c6f70579975a6954-b9c3ba9544a03500-00"
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -8,8 +8,6 @@ using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Security.Claims;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
@@ -50,9 +48,7 @@ public class UpdateLibraryEndpoint : BaseEndpoint<UpdateLibraryRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(UpdateLibraryRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
// retrieve the currently authenticated user, and send it with the request
|
||||
string? user = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
ErrorOr<LibraryResponse> result = await _sender.Send(request.ToCommand(Guid.Parse(user!)), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<LibraryResponse> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -32,7 +32,8 @@ public class UpdateLibraryEndpointSummary : Summary<UpdateLibraryEndpoint, Updat
|
||||
ContentLocations: [
|
||||
"/media/tv shows/drama/",
|
||||
"/media/tv shows/SCI-FI/",
|
||||
]
|
||||
],
|
||||
CoverImage: "/media/posters/myPoster.jpg"
|
||||
);
|
||||
|
||||
RequestParam(r => r.Id, "The Id of the media library. Required.");
|
||||
@@ -40,12 +41,14 @@ public class UpdateLibraryEndpointSummary : Summary<UpdateLibraryEndpoint, Updat
|
||||
RequestParam(r => r.Title, "The title of the media library. Required.");
|
||||
RequestParam(r => r.LibraryType, "The type of the media library. Required.");
|
||||
RequestParam(r => r.ContentLocations, ">The file system paths of the directories where the media library elements are located. Required.");
|
||||
RequestParam(r => r.CoverImage, "The path of the image file used as the cover for the library. Optional.");
|
||||
|
||||
ResponseParam<LibraryResponse>(r => r.Id, "The unique identifier of the entity.");
|
||||
ResponseParam<LibraryResponse>(r => r.UserId, "The Id of the user owning the media library.");
|
||||
ResponseParam<LibraryResponse>(r => r.Title, "The title of the media library.");
|
||||
ResponseParam<LibraryResponse>(r => r.LibraryType, "The type of the media library.");
|
||||
ResponseParam<LibraryResponse>(r => r.ContentLocations, "The file system paths of the directories where the media library elements are located.");
|
||||
ResponseParam<LibraryResponse>(r => r.CoverImage, "The path of the image file used as the cover for the library.");
|
||||
ResponseParam<LibraryResponse>(r => r.CreatedOnUtc, "The date and time when the entity was created.");
|
||||
ResponseParam<LibraryResponse>(r => r.UpdatedOnUtc, "The date and time when the entity was last updated.");
|
||||
|
||||
@@ -57,6 +60,7 @@ public class UpdateLibraryEndpointSummary : Summary<UpdateLibraryEndpoint, Updat
|
||||
Title: "TV Shows",
|
||||
LibraryType: LibraryType.TvShow,
|
||||
ContentLocations: ["/media/tv shows/drama/", "/media/tv shows/SCI-FI/"],
|
||||
"/media/myPoster.jpg",
|
||||
CreatedOnUtc: DateTime.UtcNow,
|
||||
UpdatedOnUtc: default
|
||||
));
|
||||
|
||||
Reference in new issue
Block a user