From 258f3850ed264819b506ceef885fdc97a561f79d Mon Sep 17 00:00:00 2001 From: XShine555 Date: Thu, 28 May 2026 21:44:28 +0200 Subject: [PATCH] Update endpoints --- WebApi/Endpoints/PlayListEndpoints.cs | 36 +++++++++++++-------------- WebApi/Endpoints/TrackEndpoints.cs | 32 ++++++++++++------------ WebApi/Endpoints/UserEndpoints.cs | 20 +++++++-------- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/WebApi/Endpoints/PlayListEndpoints.cs b/WebApi/Endpoints/PlayListEndpoints.cs index b58e981..46095a3 100644 --- a/WebApi/Endpoints/PlayListEndpoints.cs +++ b/WebApi/Endpoints/PlayListEndpoints.cs @@ -10,7 +10,7 @@ public static class PlayListEndpoints { public static IEndpointRouteBuilder MapPlayListEndpoints(this IEndpointRouteBuilder app) { - var group = app.MapGroup("/api/playlists") + var group = app.MapGroup("/playlists") .WithTags("PlayLists"); group.MapGet("/", GetPlayLists) @@ -46,32 +46,32 @@ public static class PlayListEndpoints private static async Task GetPlayLists( IMediator mediator, + CancellationToken cancellationToken, int pageNumber = 1, - int pageSize = 10, - CancellationToken ct = default) + int pageSize = 10) { - var result = await mediator.Send(new GetPlayListsQuery(pageNumber, pageSize), ct); + var result = await mediator.Send(new GetPlayListsQuery(pageNumber, pageSize), cancellationToken); return result.ToHttpResult(); } private static async Task GetPlayListById( IMediator mediator, Guid id, - CancellationToken ct) + CancellationToken cancellationToken) { - var result = await mediator.Send(new GetPlayListByIdQuery(id), ct); + var result = await mediator.Send(new GetPlayListByIdQuery(id), cancellationToken); return result.ToHttpResult(); } private static async Task GetPlayListsByUserId( IMediator mediator, Guid userId, - string? name, + CancellationToken cancellationToken, + string? name = null, int pageNumber = 1, - int pageSize = 10, - CancellationToken ct = default) + int pageSize = 10) { - var result = await mediator.Send(new GetPlayListsByUserIdQuery(userId, name, pageNumber, pageSize), ct); + var result = await mediator.Send(new GetPlayListsByUserIdQuery(userId, name, pageNumber, pageSize), cancellationToken); return result.ToHttpResult(); } @@ -79,11 +79,11 @@ public static class PlayListEndpoints IMediator mediator, Guid userId, CreatePlayListRequest request, - CancellationToken ct) + CancellationToken cancellationToken) { var result = await mediator.Send( new CreatePlayListCommand(userId, request.Name, request.Description, request.PictureIntentId), - ct); + cancellationToken); if (!result.IsSuccess) return result.ToHttpResult(); @@ -96,11 +96,11 @@ public static class PlayListEndpoints Guid userId, Guid playlistId, UpdatePlayListRequest request, - CancellationToken ct) + CancellationToken cancellationToken) { var result = await mediator.Send( new UpdatePlayListCommand(userId, playlistId, request.NewName, request.NewDescription, request.NewPictureIntentId), - ct); + cancellationToken); return result.ToHttpResult(); } @@ -109,9 +109,9 @@ public static class PlayListEndpoints IMediator mediator, Guid userId, Guid playlistId, - CancellationToken ct) + CancellationToken cancellationToken) { - var result = await mediator.Send(new DeletePlayListCommand(userId, playlistId), ct); + var result = await mediator.Send(new DeletePlayListCommand(userId, playlistId), cancellationToken); return result.ToHttpResult(); } @@ -119,11 +119,11 @@ public static class PlayListEndpoints IMediator mediator, Guid userId, RequestPlayListPictureUploadRequest request, - CancellationToken ct) + CancellationToken cancellationToken) { var result = await mediator.Send( new RequestPlayListPictureUploadCommand(userId, request.FileType, request.ContentType, request.ExpectedSizeBytes), - ct); + cancellationToken); return result.ToHttpResult(); } diff --git a/WebApi/Endpoints/TrackEndpoints.cs b/WebApi/Endpoints/TrackEndpoints.cs index d576341..5e182b1 100644 --- a/WebApi/Endpoints/TrackEndpoints.cs +++ b/WebApi/Endpoints/TrackEndpoints.cs @@ -10,7 +10,7 @@ public static class TrackEndpoints { public static IEndpointRouteBuilder MapTrackEndpoints(this IEndpointRouteBuilder app) { - var group = app.MapGroup("/api/tracks") + var group = app.MapGroup("/tracks") .WithTags("Tracks"); group.MapGet("/", GetTracks) @@ -42,32 +42,32 @@ public static class TrackEndpoints private static async Task GetTracks( IMediator mediator, + CancellationToken cancellationToken, int pageNumber = 1, - int pageSize = 10, - CancellationToken ct = default) + int pageSize = 10) { - var result = await mediator.Send(new GetTracksQuery(pageNumber, pageSize), ct); + var result = await mediator.Send(new GetTracksQuery(pageNumber, pageSize), cancellationToken); return result.ToHttpResult(); } private static async Task GetTrackById( IMediator mediator, Guid id, - CancellationToken ct) + CancellationToken cancellationToken) { - var result = await mediator.Send(new GetTrackByIdQuery(id), ct); + var result = await mediator.Send(new GetTrackByIdQuery(id), cancellationToken); return result.ToHttpResult(); } private static async Task GetTracksByUserId( IMediator mediator, Guid userId, - string? name, + CancellationToken cancellationToken, + string? name = null, int pageNumber = 1, - int pageSize = 10, - CancellationToken ct = default) + int pageSize = 10) { - var result = await mediator.Send(new GetTracksByUserIdQuery(userId, name, pageNumber, pageSize), ct); + var result = await mediator.Send(new GetTracksByUserIdQuery(userId, name, pageNumber, pageSize), cancellationToken); return result.ToHttpResult(); } @@ -75,11 +75,11 @@ public static class TrackEndpoints IMediator mediator, Guid userId, CreateTrackRequest request, - CancellationToken ct) + CancellationToken cancellationToken) { var result = await mediator.Send( new CreateTrackCommand(userId, request.Title, request.PictureIntentId, request.AudioIntentId), - ct); + cancellationToken); if (!result.IsSuccess) return result.ToHttpResult(); @@ -91,9 +91,9 @@ public static class TrackEndpoints IMediator mediator, Guid userId, Guid trackId, - CancellationToken ct) + CancellationToken cancellationToken) { - var result = await mediator.Send(new DeleteTrackCommand(userId, trackId), ct); + var result = await mediator.Send(new DeleteTrackCommand(userId, trackId), cancellationToken); return result.ToHttpResult(); } @@ -101,7 +101,7 @@ public static class TrackEndpoints IMediator mediator, Guid userId, RequestTrackUploadUrlsRequest request, - CancellationToken ct) + CancellationToken cancellationToken) { var result = await mediator.Send( new RequestTrackUploadUrlsCommand( @@ -112,7 +112,7 @@ public static class TrackEndpoints request.AudioContentType, request.ExpectedPictureSizeBytes, request.ExpectedAudioSizeBytes), - ct); + cancellationToken); return result.ToHttpResult(); } diff --git a/WebApi/Endpoints/UserEndpoints.cs b/WebApi/Endpoints/UserEndpoints.cs index 099d961..5c8ec83 100644 --- a/WebApi/Endpoints/UserEndpoints.cs +++ b/WebApi/Endpoints/UserEndpoints.cs @@ -10,7 +10,7 @@ public static class UserEndpoints { public static IEndpointRouteBuilder MapUserEndpoints(this IEndpointRouteBuilder app) { - var group = app.MapGroup("/api/users") + var group = app.MapGroup("/users") .WithTags("Users"); group.MapGet("/", GetUsers) @@ -34,41 +34,41 @@ public static class UserEndpoints private static async Task GetUsers( IMediator mediator, + CancellationToken cancellationToken, int pageNumber = 1, int pageSize = 10, - string? usernameSearch = null, - CancellationToken ct = default) + string? usernameSearch = null) { - var result = await mediator.Send(new GetUsersQuery(pageNumber, pageSize, usernameSearch), ct); + var result = await mediator.Send(new GetUsersQuery(pageNumber, pageSize, usernameSearch), cancellationToken); return result.ToHttpResult(); } private static async Task GetUserById( IMediator mediator, Guid id, - CancellationToken ct) + CancellationToken cancellationToken) { - var result = await mediator.Send(new GetUserByIdQuery(id), ct); + var result = await mediator.Send(new GetUserByIdQuery(id), cancellationToken); return result.ToHttpResult(); } private static async Task GetUserByKeycloak( IMediator mediator, Guid id, - CancellationToken ct) + CancellationToken cancellationToken) { - var result = await mediator.Send(new GetUserByKeycloakQuery(id), ct); + var result = await mediator.Send(new GetUserByKeycloakQuery(id), cancellationToken); return result.ToHttpResult(); } private static async Task CreateUser( IMediator mediator, CreateUserRequest request, - CancellationToken ct) + CancellationToken cancellationToken) { var result = await mediator.Send( new CreateUserCommand(request.Id, request.Name, request.FirstName, request.SecondName), - ct); + cancellationToken); if (!result.IsSuccess) return result.ToHttpResult();