wip
This commit is contained in:
parent
1ecaf64dea
commit
cb9d5e332e
11 changed files with 72 additions and 69 deletions
|
@ -1,4 +1,5 @@
|
|||
using Femto.Api.Controllers.Media.Dto;
|
||||
using Femto.Modules.Media.Application;
|
||||
using Femto.Modules.Media.Contracts;
|
||||
using Femto.Modules.Media.Contracts.LoadFile;
|
||||
using Femto.Modules.Media.Contracts.SaveFile;
|
||||
|
@ -9,7 +10,7 @@ namespace Femto.Api.Controllers.Media;
|
|||
|
||||
[ApiController]
|
||||
[Route("media")]
|
||||
public class MediaController(IMediator mediator) : ControllerBase
|
||||
public class MediaController(IMediaModule mediaModule) : ControllerBase
|
||||
{
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<UploadMediaResponse>> UploadMedia(
|
||||
|
@ -18,7 +19,7 @@ public class MediaController(IMediator mediator) : ControllerBase
|
|||
)
|
||||
{
|
||||
await using var data = file.OpenReadStream();
|
||||
var id = await mediator.Send(
|
||||
var id = await mediaModule.PostCommand(
|
||||
new SaveFileCommand(data, file.ContentType, file.Length),
|
||||
cancellationToken
|
||||
);
|
||||
|
@ -30,7 +31,7 @@ public class MediaController(IMediator mediator) : ControllerBase
|
|||
[HttpGet("{id}")]
|
||||
public async Task GetMedia(Guid id, CancellationToken cancellationToken)
|
||||
{
|
||||
var res = await mediator.Send(new LoadFileQuery(id), cancellationToken);
|
||||
var res = await mediaModule.PostQuery(new LoadFileQuery(id), cancellationToken);
|
||||
|
||||
HttpContext.Response.ContentType = res.Type;
|
||||
HttpContext.Response.ContentLength = res.Size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue