diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 14109b42..01615613 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -390,6 +390,17 @@ await callToActionOptionService.GetCallToActionOptionFromValueAsync( return BadRequest(problem); } + if(projectResource.ImageIds.Count() > 10) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Too many images.", + Detail = "A project can not have more than 10 images.", + Instance = "9E3E4F91-A6ED-415F-8726-6D33BA0F200F" + }; + return BadRequest(problem); + } + foreach(int projectResourceImageId in projectResource.ImageIds) { Models.File image = await fileService.FindAsync(projectResourceImageId); @@ -574,6 +585,17 @@ await callToActionOptionService.GetCallToActionOptionFromValueAsync( project.ProjectIcon = null; } + if(projectResource.ImageIds.Count() > 10) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Too many images.", + Detail = "A project can not have more than 10 images.", + Instance = "5D179737-046E-482B-B6D8-DDDCEF518107" + }; + return BadRequest(problem); + } + project.Images.Clear(); foreach(int projectResourceImageId in projectResource.ImageIds) { diff --git a/CHANGELOG.md b/CHANGELOG.md index 96a0b8bb..da32d191 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Include categories in retrieving a user's project - [#468](https://github.com/DigitalExcellence/dex-backend/issues/468) - Lowercase file extensions on upload - [#472](https://github.com/DigitalExcellence/dex-backend/issues/472) - Fixed an issue where Swagger could not authorize with IdentityServer - [#429](https://github.com/DigitalExcellence/dex-backend/issues/429) +- Projects now has a maximum of 10 images - [#475](https://github.com/DigitalExcellence/dex-backend/issues/475) ### Security