mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 07:42:23 +00:00
Answer the native client's open server asks
- Publish timezone, glucoseUnit and a features block on the account payload; glucoseUnit reads as the closed pair the contract names, and features.trackIntake tells a separately released client that medications take the record-only switch. - Refuse a new dose for a record-only medication with medication.intake.notTracked on every dose-writing route; the bulk route reports it per entry as intake_not_tracked, and correcting an already resolved event stays open. - Answer passkey sign-in failures by name instead of a 500: passkey.challenge.expired, passkey.unknown, passkey.response.invalid and passkey.verification.failed, each with an audit row. - Carry one account-wide adherence figure in meta.aggregate on the batched compliance read, weighted by expected doses, and accept ?days=30|60|90|180|365 for a report window. - Accept ?days=30|90|180|365 on the mood insights read so stability covers the period shown, and name the window it covers. - Keep only the reminder that announces a dose off APNs when the phone owns medication reminders; follow-ups for a dose still open are pushed again, marked by a followUp flag the reminder cron sets. - Document which batch validation issues belong to an entry and pin it with a test that splits and resends a batch; publish rejectedFields items as ValidationIssue.
This commit is contained in:
1 parent
7bcb6f71d9
commit
bb563b6506
50 files changed
+1789
-142
No files matched your search
@@ -6,6 +6,20 @@ export function apiSuccess<T>(data: T, status = 200) {
|
||||
return NextResponse.json({ data, error: null }, { status });
|
||||
}
|
||||
|
||||
/**
|
||||
* A success envelope that also carries `meta`: figures ABOUT the payload
|
||||
* (an aggregate across its rows, the window it was cut to) that do not belong
|
||||
* inside any one row. `data` keeps the shape the route always had, so a
|
||||
* client that never reads `meta` decodes the response unchanged.
|
||||
*/
|
||||
export function apiSuccessWithMeta<T>(
|
||||
data: T,
|
||||
meta: Record<string, unknown>,
|
||||
status = 200,
|
||||
) {
|
||||
return NextResponse.json({ data, error: null, meta }, { status });
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitised view of a single Zod issue. We surface `path`, `code`,
|
||||
* `message` and — for `unrecognized_keys` only — the bounded `keys`
|
||||
|
||||
Reference in new issue
Block a user