using Manager.App.Services; using Microsoft.AspNetCore.Mvc; namespace Manager.App.Controllers; [ApiController] [Route("api/v1/[controller]")] public class FileController(ILibraryService libraryService) : ControllerBase { [HttpGet("provide")] public async Task ProvideFile([FromQuery(Name = "id")] Guid id, CancellationToken cancellationToken) { var fileResult = await libraryService.GetFileByIdAsync(id, cancellationToken); if (!fileResult.IsSuccess) { return BadRequest(fileResult.Error); } var libFile = fileResult.Value; return File(libFile.DataStream, libFile.MimeType, libFile.FileName); } }