summaryrefslogtreecommitdiff
path: root/backend/Elements.Backend/Controllers/SuggestionController.cs
diff options
context:
space:
mode:
authorPaweł Bernaciak <pawelbernaciak@zohomail.eu>2023-10-25 20:28:34 +0200
committerPaweł Bernaciak <pawelbernaciak@zohomail.eu>2023-10-25 20:28:34 +0200
commit2e86ace4593d32a2cb1a4be9a758911ff25e4a89 (patch)
tree33582ae0ef03f6a1556f950a43004bba6c1ee0f2 /backend/Elements.Backend/Controllers/SuggestionController.cs
parent68e4282555a55f429320b80f09f609970dc76e92 (diff)
Model fixes
Diffstat (limited to 'backend/Elements.Backend/Controllers/SuggestionController.cs')
-rw-r--r--backend/Elements.Backend/Controllers/SuggestionController.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/backend/Elements.Backend/Controllers/SuggestionController.cs b/backend/Elements.Backend/Controllers/SuggestionController.cs
index 77a3944..040b19b 100644
--- a/backend/Elements.Backend/Controllers/SuggestionController.cs
+++ b/backend/Elements.Backend/Controllers/SuggestionController.cs
@@ -112,16 +112,18 @@ public class SuggestionController : ControllerBase
if (currentUserId == null)
return StatusCode(StatusCodes.Status500InternalServerError);
+ //User already suggested something
if (await _dbContext.Suggestions.AnyAsync(s => s.UserId.ToString() == currentUserId))
return BadRequest();
Suggestion newSuggestion = new()
{
+ CreationDate = DateTime.UtcNow,
Name = suggestion.Name,
Icon = ConvertBitmapToPng(Convert.FromBase64String(suggestion.IconBitmap)),
FirstElementId = suggestion.FirstElementId,
SecondElementId = suggestion.SecondElementId,
- VotingEnd = DateTime.UtcNow + TimeSpan.FromMinutes(1),
+ VotingEnd = DateTime.UtcNow + TimeSpan.FromSeconds(10),
UserId = int.Parse(currentUserId)
};
await _dbContext.Suggestions.AddAsync(newSuggestion);