mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
fix(api): rename coach.batch.too_large to measurement.batch.too_large
The batch ingest route lives under /api/measurements, not the Coach. Aligns the errorCode with the sibling DELETE route, which already emits measurement.delete.too_large.
This commit is contained in:
1 parent
ab54d86bf8
commit
f16d4b3f0e
2 files changed
+3
-3
No files matched your search
@@ -137,7 +137,7 @@ async function postBatch(request: NextRequest): Promise<Response> {
|
||||
(rawBody as { entries: unknown[] }).entries.length > MAX_BATCH_ENTRIES
|
||||
) {
|
||||
return apiError(`Batch exceeds the ${MAX_BATCH_ENTRIES}-entry limit`, 422, {
|
||||
errorCode: "coach.batch.too_large",
|
||||
errorCode: "measurement.batch.too_large",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ describe("POST /api/measurements/batch (real Postgres)", () => {
|
||||
expect(stored).toHaveLength(2);
|
||||
});
|
||||
|
||||
it("returns 422 with coach.batch.too_large when entries exceed the cap", async () => {
|
||||
it("returns 422 with measurement.batch.too_large when entries exceed the cap", async () => {
|
||||
const { POST } = await import("@/app/api/measurements/batch/route");
|
||||
|
||||
const entries: BatchEntryFixture[] = [];
|
||||
@@ -217,7 +217,7 @@ describe("POST /api/measurements/batch (real Postgres)", () => {
|
||||
meta?: { errorCode?: string };
|
||||
};
|
||||
expect(json.error).toMatch(/500/);
|
||||
expect(json.meta?.errorCode).toBe("coach.batch.too_large");
|
||||
expect(json.meta?.errorCode).toBe("measurement.batch.too_large");
|
||||
});
|
||||
|
||||
it("flags unmappable identifiers and out-of-range values as skipped", async () => {
|
||||
|
||||
Reference in new issue
Block a user