Add endpoint to list paginated tracks of a playlist
This commit is contained in:
@@ -27,6 +27,10 @@ public static class PlayListEndpoints
|
|||||||
.WithName("GetPlayListsByUserId")
|
.WithName("GetPlayListsByUserId")
|
||||||
.WithSummary("Get Paginated PlayLists For A User.");
|
.WithSummary("Get Paginated PlayLists For A User.");
|
||||||
|
|
||||||
|
group.MapGet("/{playlistId}/tracks", GetPlayListTracks)
|
||||||
|
.WithName("GetPlayListTracks")
|
||||||
|
.WithSummary("Get Paginated Tracks Of A PlayList.");
|
||||||
|
|
||||||
group.MapPost("/", CreatePlayList)
|
group.MapPost("/", CreatePlayList)
|
||||||
.WithName("CreatePlayList")
|
.WithName("CreatePlayList")
|
||||||
.WithSummary("Create A New PlayList.")
|
.WithSummary("Create A New PlayList.")
|
||||||
@@ -94,6 +98,17 @@ public static class PlayListEndpoints
|
|||||||
return result.ToHttpResult();
|
return result.ToHttpResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static async Task<IResult> GetPlayListTracks(
|
||||||
|
IMediator mediator,
|
||||||
|
Guid playlistId,
|
||||||
|
CancellationToken cancellationToken,
|
||||||
|
int pageNumber = 1,
|
||||||
|
int pageSize = 10)
|
||||||
|
{
|
||||||
|
var result = await mediator.Send(new GetPlayListTracksQuery(playlistId, pageNumber, pageSize), cancellationToken);
|
||||||
|
return result.ToHttpResult();
|
||||||
|
}
|
||||||
|
|
||||||
private static async Task<IResult> CreatePlayList(
|
private static async Task<IResult> CreatePlayList(
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
CurrentUser currentUser,
|
CurrentUser currentUser,
|
||||||
|
|||||||
Reference in New Issue
Block a user