mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 11:11:10 +00:00
Adds music stack test coverage and fixes playlist cache and stream error handling
This commit is contained in:
1 parent
394f6b510c
commit
aba803b106
197 files changed
+29081
-34
No files matched your search
+4
@@ -51,6 +51,10 @@ public class AddPlaylistEntriesEndpoint : BaseEndpoint<AddPlaylistEntriesRequest
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(AddPlaylistEntriesRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
// The playlists belong to the authenticated user, so no intermediary may store any response of this route, including its problem
|
||||
// responses, and every response varies by the bearer token that authorized it.
|
||||
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
|
||||
HttpContext.Response.Headers["Vary"] = "Authorization";
|
||||
// The playlist is identified by the route value, not by any id posted in the body.
|
||||
string? playlistId = HttpContext.Request.RouteValues["playlistId"]?.ToString();
|
||||
Result<PlaylistEntriesAddedResponse> result = await _addPlaylistEntriesCommandHandler.HandleAsync(request.ToCommand(playlistId), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
+4
@@ -51,6 +51,10 @@ public class AddPlaylistEntryEndpoint : BaseEndpoint<AddPlaylistEntryRequest, IR
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(AddPlaylistEntryRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
// The playlists belong to the authenticated user, so no intermediary may store any response of this route, including its problem
|
||||
// responses, and every response varies by the bearer token that authorized it.
|
||||
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
|
||||
HttpContext.Response.Headers["Vary"] = "Authorization";
|
||||
// The playlist is identified by the route value, not by any id posted in the body.
|
||||
string? playlistId = HttpContext.Request.RouteValues["playlistId"]?.ToString();
|
||||
Result<PlaylistEntryAddedResponse> result = await _addPlaylistEntryCommandHandler.HandleAsync(request.ToCommand(playlistId), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
+4
@@ -51,6 +51,10 @@ public class AddPlaylistScopeEntriesEndpoint : BaseEndpoint<AddPlaylistScopeEntr
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(AddPlaylistScopeEntriesRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
// The playlists belong to the authenticated user, so no intermediary may store any response of this route, including its problem
|
||||
// responses, and every response varies by the bearer token that authorized it.
|
||||
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
|
||||
HttpContext.Response.Headers["Vary"] = "Authorization";
|
||||
// The playlist is identified by the route value, not by any id posted in the body.
|
||||
string? playlistId = HttpContext.Request.RouteValues["playlistId"]?.ToString();
|
||||
Result<PlaylistEntriesAddedResponse> result = await _addPlaylistScopeEntriesCommandHandler.HandleAsync(request.ToCommand(playlistId), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
+4
@@ -51,6 +51,10 @@ public class CreatePlaylistEndpoint : BaseEndpoint<CreatePlaylistRequest, IResul
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(CreatePlaylistRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
// The playlists belong to the authenticated user, so no intermediary may store any response of this route, including its problem
|
||||
// responses, and every response varies by the bearer token that authorized it.
|
||||
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
|
||||
HttpContext.Response.Headers["Vary"] = "Authorization";
|
||||
Result<PlaylistResponse> result = await _createPlaylistCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
|
||||
+4
@@ -48,6 +48,10 @@ public class DeletePlaylistEndpoint : BaseEndpoint<FastEndpoints.EmptyRequest, I
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(FastEndpoints.EmptyRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
// The playlists belong to the authenticated user, so no intermediary may store any response of this route, including its problem
|
||||
// responses, and every response varies by the bearer token that authorized it.
|
||||
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
|
||||
HttpContext.Response.Headers["Vary"] = "Authorization";
|
||||
// Take the unique identifier from the route.
|
||||
string? playlistId = HttpContext.Request.RouteValues["playlistId"]?.ToString();
|
||||
Result<Deleted> result = await _deletePlaylistCommandHandler.HandleAsync(new DeletePlaylistCommand(playlistId), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
+4
@@ -51,6 +51,10 @@ public class MovePlaylistEntryEndpoint : BaseEndpoint<MovePlaylistEntryRequest,
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(MovePlaylistEntryRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
// The playlists belong to the authenticated user, so no intermediary may store any response of this route, including its problem
|
||||
// responses, and every response varies by the bearer token that authorized it.
|
||||
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
|
||||
HttpContext.Response.Headers["Vary"] = "Authorization";
|
||||
// The playlist and the entry are identified by the route values, not by any id posted in the body.
|
||||
string? playlistId = HttpContext.Request.RouteValues["playlistId"]?.ToString();
|
||||
string? playlistEntryId = HttpContext.Request.RouteValues["playlistEntryId"]?.ToString();
|
||||
|
||||
+4
@@ -49,6 +49,10 @@ public class RemovePlaylistEntryEndpoint : BaseEndpoint<FastEndpoints.EmptyReque
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(FastEndpoints.EmptyRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
// The playlists belong to the authenticated user, so no intermediary may store any response of this route, including its problem
|
||||
// responses, and every response varies by the bearer token that authorized it.
|
||||
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
|
||||
HttpContext.Response.Headers["Vary"] = "Authorization";
|
||||
// Take the unique identifiers from the route.
|
||||
string? playlistId = HttpContext.Request.RouteValues["playlistId"]?.ToString();
|
||||
string? playlistEntryId = HttpContext.Request.RouteValues["playlistEntryId"]?.ToString();
|
||||
|
||||
+4
@@ -51,6 +51,10 @@ public class UpdatePlaylistEndpoint : BaseEndpoint<UpdatePlaylistRequest, IResul
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(UpdatePlaylistRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
// The playlists belong to the authenticated user, so no intermediary may store any response of this route, including its problem
|
||||
// responses, and every response varies by the bearer token that authorized it.
|
||||
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
|
||||
HttpContext.Response.Headers["Vary"] = "Authorization";
|
||||
// The playlist is identified by the route value, not by any id posted in the body, so that a mismatched id can never redirect the
|
||||
// update to another playlist.
|
||||
string? playlistId = HttpContext.Request.RouteValues["playlistId"]?.ToString();
|
||||
|
||||
Reference in new issue
Block a user