fix: fixes to addQuote (don't require categories nor imageUrl)

also sends back role upon login
This commit is contained in:
2025-07-17 10:55:38 +02:00
parent 3cd2eff522
commit 2350935e8a
4 changed files with 6 additions and 5 deletions

View File

@@ -141,13 +141,13 @@ public class QuotesController : ControllerBase
Author = request.Author,
CreatedAt = DateTime.UtcNow,
LastUpdatedAt = DateTime.UtcNow,
ImageId = image?.Id ?? 0,
ImageId = image?.Id ?? null,
UserId = userId,
QuoteCategories = new List<QuoteCategory>()
};
// Attach categories
foreach (var categoryId in request.CategoryIds)
foreach (var categoryId in request.CategoryIds ?? [])
{
var categoryExists = await _db.Categories.AnyAsync(c => c.Id == categoryId);
if (!categoryExists)