diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index cabc0a22..c766ec70 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -391,6 +391,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); @@ -575,6 +586,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 054cb058..7be32141 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,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