Updated SearchHistoryEndpoints.cs

Fixed wrong Model for SearchHistory, was using Regular History class,
instead of SearchHistory class.
This commit is contained in:
Mario Steele 2025-07-19 12:40:00 -05:00
parent 15d949d7e1
commit 2e27078443

View file

@ -8,13 +8,13 @@ public static class SearchHistoryEndpoint
{
var group = app.MapGroup("searchHistory");
group.MapGet("/", async (IRepository<History> repository, CancellationToken ct) =>
group.MapGet("/", async (IRepository<SearchHistory> repository, CancellationToken ct) =>
{
var result = await repository.GetAllAsync(ct);
return Results.Ok(result);
});
group.MapPost("/", async (IRepository<History> repository, CancellationToken ct, History history) =>
group.MapPost("/", async (IRepository<SearchHistory> repository, CancellationToken ct, SearchHistory history) =>
{
var result = await repository.GetByIdAsync(history._id, ct);
if (result != null)
@ -24,7 +24,7 @@ public static class SearchHistoryEndpoint
return Results.Ok();
});
group.MapDelete("/{id}", async (IRepository<History> repository, CancellationToken ct, string id) =>
group.MapDelete("/{id}", async (IRepository<SearchHistory> repository, CancellationToken ct, string id) =>
{
var result = await repository.GetByIdAsync(id, ct);
if (result == null) return Results.NotFound();