mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 07:13:12 +00:00
fix(workorders): raise media upload limit to 200 MB
This commit is contained in:
parent
ad5d58437c
commit
a615be28e5
2 changed files with 6 additions and 6 deletions
|
|
@ -31,7 +31,7 @@ public class WorkOrderMediaControllerTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void AddMedia_HasFiftyMegabyteRequestLimit()
|
||||
public void AddMedia_HasTwoHundredMegabyteRequestLimit()
|
||||
{
|
||||
var method = typeof(WorkOrderMediaController).GetMethod(nameof(WorkOrderMediaController.AddMedia));
|
||||
var attribute = Assert.Single(
|
||||
|
|
@ -39,14 +39,14 @@ public class WorkOrderMediaControllerTests
|
|||
candidate => candidate.AttributeType == typeof(RequestSizeLimitAttribute));
|
||||
var bytes = Assert.Single(attribute.ConstructorArguments);
|
||||
|
||||
Assert.Equal(50_000_000L, bytes.Value);
|
||||
Assert.Equal(200_000_000L, bytes.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AddMedia_FileOverLimit_ReturnsStableUnprocessableEntity()
|
||||
{
|
||||
var file = new Mock<IFormFile>();
|
||||
file.SetupGet(candidate => candidate.Length).Returns(50_000_001);
|
||||
file.SetupGet(candidate => candidate.Length).Returns(200_000_001);
|
||||
var storage = new Mock<IFileStoragePort>(MockBehavior.Strict);
|
||||
var controller = CreateController(storage: storage);
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ public class WorkOrderMediaControllerTests
|
|||
var response = Assert.IsType<UnprocessableEntityObjectResult>(result);
|
||||
var error = Assert.IsType<WorkOrderBoardValidationErrorDto>(response.Value);
|
||||
Assert.Equal("FileTooLarge", error.Code);
|
||||
Assert.Equal("The uploaded file must not exceed 50 MB.", error.Message);
|
||||
Assert.Equal("The uploaded file must not exceed 200 MB.", error.Message);
|
||||
storage.VerifyNoOtherCalls();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Api.SeaHavenIndustries.Controllers
|
|||
[Route("api/workorders")]
|
||||
public class WorkOrderMediaController : Controller
|
||||
{
|
||||
public const long MaxUploadBytes = 50_000_000;
|
||||
public const long MaxUploadBytes = 200_000_000;
|
||||
|
||||
private readonly IWorkOrderMediaService _workOrderMediaService;
|
||||
private readonly IFileStoragePort _fileStorage;
|
||||
|
|
@ -91,7 +91,7 @@ namespace Api.SeaHavenIndustries.Controllers
|
|||
{
|
||||
throw new WorkOrderBoardValidationException(
|
||||
"FileTooLarge",
|
||||
"The uploaded file must not exceed 50 MB.");
|
||||
"The uploaded file must not exceed 200 MB.");
|
||||
}
|
||||
|
||||
WorkOrderMediaFileRules.EnsureAllowed(file, category);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue