Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limited amount of images per project to 10 #476

Merged
merged 2 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions API/Controllers/ProjectController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down