diff --git a/src/TransmissionManager.Api/Endpoints/TorrentEndpoints.cs b/src/TransmissionManager.Api/Endpoints/TorrentEndpoints.cs index cfb0326..5f4c556 100644 --- a/src/TransmissionManager.Api/Endpoints/TorrentEndpoints.cs +++ b/src/TransmissionManager.Api/Endpoints/TorrentEndpoints.cs @@ -16,21 +16,21 @@ public static IEndpointRouteBuilder MapTorrentEndpoints(this IEndpointRouteBuild group.MapGet("/", FindMany); group.MapGet("/{id}", FindOneById); group.MapPost("/", TryAddOrUpdateOneAsync); - group.MapPut("/{id}", UpdateOne); - group.MapDelete("/{id}", RemoveOne); + group.MapPut("/{id}", UpdateOneById); + group.MapDelete("/{id}", RemoveOneById); return builder; } private static Torrent[] FindMany( - [FromServices] TorrentService torrentService, + [FromServices] TorrentService service, int take = 20, long afterId = 0, string? webPageUri = null, string? nameStartsWith = null, bool? cronExists = null) { - return torrentService.FindPage(new() + return service.FindPage(new() { Take = take, AfterId = afterId, @@ -46,25 +46,23 @@ private static Torrent[] FindMany( } private static Task TryAddOrUpdateOneAsync( - [FromServices] CompositeService compositeService, + [FromServices] CompositeService service, TorrentPostRequest dto, CancellationToken cancellationToken = default) { - return compositeService.TryAddOrUpdateTorrentAsync(dto, cancellationToken); + return service.TryAddOrUpdateTorrentAsync(dto, cancellationToken); } - private static void UpdateOne( - [FromServices] SchedulableTorrentService torrentService, + private static void UpdateOneById( + [FromServices] SchedulableTorrentService service, long id, TorrentPutRequest dto) { - torrentService.UpdateOneById(id, dto.ToTorrentUpdateDto()); + service.UpdateOneById(id, dto.ToTorrentUpdateDto()); } - private static void RemoveOne( - [FromServices] SchedulableTorrentService torrentService, - long id) + private static void RemoveOneById([FromServices] SchedulableTorrentService service, long id) { - torrentService.DeleteOneById(id); + service.DeleteOneById(id); } }