Skip to content

Commit 0b6b20e

Browse files
committed
feat [back]: showing max files count on limit exceeding
1 parent 6345026 commit 0b6b20e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

HwProj.APIGateway/HwProj.APIGateway.API/Controllers/FilesController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public async Task<IActionResult> Process([FromForm] ProcessFilesDTO processFiles
4040
if (!checkRights) return StatusCode((int)HttpStatusCode.Forbidden, "Недостаточно прав для загрузки файлов");
4141

4242
var checkCountLimit = await _countFilter.CheckCountLimit(processFilesDto);
43-
if (!checkCountLimit) return StatusCode((int)HttpStatusCode.Forbidden, "Слишком много файлов в решении");
43+
if (!checkCountLimit) return StatusCode((int)HttpStatusCode.Forbidden, "Слишком много файлов в решении."
44+
+ $"Максимальное количество файлов - ${_countFilter.maxSolutionFiles}");
4445

4546
var result = await _contentServiceClient.ProcessFilesAsync(processFilesDto);
4647
return result.Succeeded

HwProj.APIGateway/HwProj.APIGateway.API/Filters/FilesCountLimit.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace HwProj.APIGateway.API.Filters;
99
public class FilesCountLimit
1010
{
1111
private readonly IContentServiceClient _contentServiceClient;
12-
private readonly long _maxSolutionFiles = 5;
12+
public readonly long maxSolutionFiles = 5;
1313

1414
public FilesCountLimit(IContentServiceClient contentServiceClient)
1515
{
@@ -29,7 +29,7 @@ public async Task<bool> CheckCountLimit(ProcessFilesDTO processFilesDto)
2929
return false;
3030
}
3131

32-
if (existingIds.Count() + processFilesDto.NewFiles.Count - processFilesDto.DeletingFileIds.Count > _maxSolutionFiles)
32+
if (existingIds.Count() + processFilesDto.NewFiles.Count - processFilesDto.DeletingFileIds.Count > maxSolutionFiles)
3333
{
3434
return false;
3535
}

0 commit comments

Comments
 (0)