Remove downloads management features: delete DownloadsEndpoints and related API logic, remove associated frontend components and routes, and update documentation to reflect the removal of the downloads directory from the application structure.

This commit is contained in:
Leonid Pershin
2026-07-24 18:18:22 +03:00
parent 44d10f667c
commit 7309a25764
18 changed files with 6 additions and 382 deletions
@@ -1,52 +0,0 @@
using LiteCqrs;
using TeleWave.Api.Common;
using TeleWave.Application.Common.Interfaces;
using TeleWave.Application.Media.Downloads;
using TeleWave.Application.Media.Register;
using TeleWave.Domain.Media;
using TeleWave.Infrastructure.Identity;
namespace TeleWave.Api.Endpoints;
public static class DownloadsEndpoints
{
public static IEndpointRouteBuilder MapDownloadsEndpoints(this IEndpointRouteBuilder app)
{
var admin = app.MapGroup("/api/admin/downloads")
.WithTags("Admin.Downloads")
.RequireAuthorization(policy => policy.RequireRole(RoleNames.Admin));
admin.MapGet("", List).Produces<IReadOnlyList<DownloadFileDto>>();
admin.MapPost("/import", Import).Produces<CreatedIdResponse>(StatusCodes.Status201Created);
return app;
}
private static async Task<IResult> List(ISender sender, CancellationToken cancellationToken)
{
var result = await sender.Send(new ListDownloadsQuery(), cancellationToken);
return Results.Ok(result);
}
/// <summary>Импорт выбранного файла из downloads/: регистрирует ассет (копией) и ставит в обработку.</summary>
private static async Task<IResult> Import(
ImportDownloadBody body,
ISender sender,
IMediaProcessingQueue queue,
CancellationToken cancellationToken
)
{
var fileName = Path.GetFileName(body.RelativePath);
var result = await sender.Send(
new RegisterMediaAssetCommand(body.RelativePath, MediaSource.Download, fileName),
cancellationToken
);
if (!result.IsSuccess)
return result.ToHttpResult();
queue.Enqueue(result.Value);
return Results.Created($"/api/admin/media/{result.Value}", new CreatedIdResponse(result.Value));
}
}
public sealed record ImportDownloadBody(string RelativePath);
-1
View File
@@ -113,7 +113,6 @@ app.MapAuthEndpoints();
app.MapRoleEndpoints();
app.MapAdminUserEndpoints();
app.MapMediaEndpoints();
app.MapDownloadsEndpoints();
app.MapShowEndpoints();
app.MapChannelEndpoints();
app.MapStreamingEndpoints();