Implement media storage and processing features: update configuration in .env.example and appsettings files, enhance Docker setup for media storage, and add media-related services and database entities. Include ffmpeg for media handling and adjust Kestrel settings for large file uploads.

This commit is contained in:
Leonid Pershin
2026-07-24 08:33:11 +03:00
parent 1dd6991174
commit e15ecbdb29
47 changed files with 2599 additions and 1 deletions
@@ -0,0 +1,29 @@
using LiteCqrs;
using Microsoft.EntityFrameworkCore;
using TeleWave.Application.Common.Interfaces;
using TeleWave.Application.Common.Models;
namespace TeleWave.Application.Media.Delete;
public sealed class DeleteMediaAssetCommandHandler(IAppDbContext dbContext, IMediaStorage storage)
: ICommandHandler<DeleteMediaAssetCommand, Result>
{
public async Task<Result> Handle(
DeleteMediaAssetCommand command,
CancellationToken cancellationToken
)
{
var asset = await dbContext.MediaAssets.FirstOrDefaultAsync(
x => x.Id == command.Id,
cancellationToken
);
if (asset is null)
return Result.Failure(MediaErrors.NotFound);
// TODO(этап 2): запретить удаление, пока ассет используется в расписании/пуле канала.
storage.DeleteAssetArtifacts(asset.Id, asset.OriginalExtension);
dbContext.MediaAssets.Remove(asset);
return Result.Success();
}
}