mirror of
https://github.com/QuotifyTeam/QuotifyBE.git
synced 2025-12-16 23:00:07 +01:00
feat: return creation/update time
This commit is contained in:
@@ -29,4 +29,28 @@ public static class QuoteMapping
|
||||
Categories = categoryNames
|
||||
};
|
||||
}
|
||||
|
||||
public static QuoteCompleteDTO ToQuoteCompleteDTO(this Quote quote)
|
||||
{
|
||||
|
||||
List<string> categoryNames = [];
|
||||
if (quote.QuoteCategories != null)
|
||||
{
|
||||
foreach (QuoteCategory quoteCategory in quote.QuoteCategories)
|
||||
{
|
||||
categoryNames.Add(quoteCategory.Category!.Name ?? $"Unnamed category {quoteCategory.CategoryId}");
|
||||
}
|
||||
}
|
||||
|
||||
return new QuoteCompleteDTO
|
||||
{
|
||||
Id = quote.Id,
|
||||
Text = quote.Text,
|
||||
Author = quote.Author,
|
||||
ImageUrl = quote.Image?.Url,
|
||||
Categories = categoryNames,
|
||||
createDate = quote.CreatedAt,
|
||||
updateDate = quote.LastUpdatedAt
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user