Updated SearchHistoryEndpoints.cs
Fixed wrong Model for SearchHistory, was using Regular History class, instead of SearchHistory class.
This commit is contained in:
parent
15d949d7e1
commit
2e27078443
1 changed files with 3 additions and 3 deletions
|
|
@ -8,13 +8,13 @@ public static class SearchHistoryEndpoint
|
||||||
{
|
{
|
||||||
var group = app.MapGroup("searchHistory");
|
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);
|
var result = await repository.GetAllAsync(ct);
|
||||||
return Results.Ok(result);
|
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);
|
var result = await repository.GetByIdAsync(history._id, ct);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
|
|
@ -24,7 +24,7 @@ public static class SearchHistoryEndpoint
|
||||||
return Results.Ok();
|
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);
|
var result = await repository.GetByIdAsync(id, ct);
|
||||||
if (result == null) return Results.NotFound();
|
if (result == null) return Results.NotFound();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue