DATA-2: optional list params + normalize frontend's '==' Gridify operator
- GridifyParams wrapper: nullable page/pageSize/filter/orderBy so list endpoints work with no query params (Gridify's non-nullable int Page made [AsParameters] treat them as required -> 400). Defaults page=1,pageSize=20. - Normalize incoming filter '==' -> '=' : the frontend gridify.ts emits '==' for equals (its convention) but Gridify's equals is '='. Safe (values are escaped; != >= <= =* contain no '=='). Fixes status==Active (frontend default that 500'd). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,7 @@ namespace GerbilManagerWebAPI.Endpoints
|
||||
var group = app.MapGroup("/health-records").WithTags("HealthRecords");
|
||||
|
||||
// GET /health-records?filter=gerbilId==…
|
||||
group.MapGet("/", async ([AsParameters] GridifyQuery query, ApplicationContext db) =>
|
||||
group.MapGet("/", async ([AsParameters] GridifyParams query, ApplicationContext db) =>
|
||||
TypedResults.Ok(await db.HealthRecords.AsNoTracking().ToPagedResultAsync(query, ToDto)));
|
||||
|
||||
group.MapGet("/{id:guid}", async Task<Results<Ok<HealthRecordDto>, NotFound>> (Guid id, ApplicationContext db) =>
|
||||
@@ -66,7 +66,7 @@ namespace GerbilManagerWebAPI.Endpoints
|
||||
{
|
||||
var group = app.MapGroup("/weight-records").WithTags("WeightRecords");
|
||||
|
||||
group.MapGet("/", async ([AsParameters] GridifyQuery query, ApplicationContext db) =>
|
||||
group.MapGet("/", async ([AsParameters] GridifyParams query, ApplicationContext db) =>
|
||||
TypedResults.Ok(await db.WeightRecords.AsNoTracking().ToPagedResultAsync(query, ToDto)));
|
||||
|
||||
group.MapGet("/{id:guid}", async Task<Results<Ok<WeightRecordDto>, NotFound>> (Guid id, ApplicationContext db) =>
|
||||
|
||||
Reference in New Issue
Block a user