Introduce typed API responses and align workflow outputs
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using GameList.Contracts;
|
||||
using GameList.Data;
|
||||
using GameList.Domain;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -54,8 +55,12 @@ internal sealed class ResultsWorkflowService(AppDbContext db)
|
||||
.Where(id => id != r.Id)
|
||||
.ToList();
|
||||
|
||||
return new
|
||||
{
|
||||
var linkedTitles = linkedIds
|
||||
.Where(nameLookup.ContainsKey)
|
||||
.Select(id => nameLookup[id])
|
||||
.ToList();
|
||||
|
||||
return new ResultItemDto(
|
||||
r.Id,
|
||||
r.Name,
|
||||
r.Author,
|
||||
@@ -72,12 +77,9 @@ internal sealed class ResultsWorkflowService(AppDbContext db)
|
||||
r.Description,
|
||||
r.Genre,
|
||||
r.ParentSuggestionId,
|
||||
LinkedIds = linkedIds,
|
||||
LinkedTitles = linkedIds
|
||||
.Where(nameLookup.ContainsKey)
|
||||
.Select(id => nameLookup[id])
|
||||
.ToList()
|
||||
};
|
||||
linkedIds,
|
||||
linkedTitles
|
||||
);
|
||||
});
|
||||
|
||||
return Results.Ok(shaped);
|
||||
|
||||
Reference in New Issue
Block a user