mirror of
https://github.com/QuotifyTeam/QuotifyBE.git
synced 2025-12-16 14:20:06 +01:00
fix: db model fixes and quote mapping
This commit is contained in:
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using QuotifyBE.Data;
|
||||
using QuotifyBE.Entities;
|
||||
using QuotifyBE.Mapping;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@@ -40,7 +41,7 @@ public class QuotesController : ControllerBase
|
||||
.Include(q => q.QuoteCategories!)
|
||||
.ThenInclude(qc => qc.Category)
|
||||
.Include(q => q.User)
|
||||
.Include(q => q.ImageId)
|
||||
.Include(q => q.Image)
|
||||
.FirstOrDefaultAsync(q => q.Id == id);
|
||||
|
||||
if (quote == null)
|
||||
@@ -48,7 +49,7 @@ public class QuotesController : ControllerBase
|
||||
|
||||
// TODO: Consider turning the quote into a DTO
|
||||
|
||||
return Ok(quote);
|
||||
return Ok(quote.ToQuoteShortDTO(_db));
|
||||
}
|
||||
|
||||
// POST /api/v1/quotes/new
|
||||
@@ -135,7 +136,7 @@ public class QuotesController : ControllerBase
|
||||
image = await _db.Images.FirstOrDefaultAsync(i => i.Id == quote.ImageId);
|
||||
}
|
||||
|
||||
var dto = new RandomQuote
|
||||
var dto = new QuoteShortDTO
|
||||
{
|
||||
Text = quote.Text,
|
||||
Author = quote.Author,
|
||||
|
||||
Reference in New Issue
Block a user