mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
Merge branch 'fix/v1437-r2-errors' into release/v1.43.7
# Conflicts: # src/components/charts/health-chart.tsx # src/components/insights/ecg-cross-link.tsx # src/components/insights/ecg-section.tsx # src/components/insights/rhythm-events-card.tsx
This commit is contained in:
commit
86eb743a69
134 files changed
+1567
-594
No files matched your search
@@ -66,7 +66,11 @@ import { prisma } from "@/lib/db";
|
||||
import { getAuditLogRetentionDays } from "@/lib/jobs/audit-log-cleanup";
|
||||
import { annotate } from "@/lib/logging/context";
|
||||
import { checkRateLimit } from "@/lib/rate-limit";
|
||||
import { GRANT_PARTY_SELECT, toGrantView } from "@/lib/sharing/grant-view";
|
||||
import {
|
||||
GRANT_PARTY_SELECT,
|
||||
INVITE_NO_ACCOUNT_CODE,
|
||||
toGrantView,
|
||||
} from "@/lib/sharing/grant-view";
|
||||
import { GrantError, inviteGrant } from "@/lib/sharing/grants";
|
||||
import { inviteGrantSchema } from "@/lib/validations/account-sharing";
|
||||
import { apiListSuccess, capRows, overfetch } from "@/lib/api/list-cap";
|
||||
@@ -221,7 +225,9 @@ export const POST = apiHandler(async (request: NextRequest) => {
|
||||
select: GRANT_PARTY_SELECT,
|
||||
});
|
||||
if (!invitee) {
|
||||
return apiError("No account with that name or e-mail", 404);
|
||||
return apiError("No account with that name or e-mail", 404, {
|
||||
errorCode: INVITE_NO_ACCOUNT_CODE,
|
||||
});
|
||||
}
|
||||
|
||||
await auth.commitElevation();
|
||||
|
||||
@@ -322,8 +322,8 @@ describe("GET /api/insights/targets — mood-rollup tier swap", () => {
|
||||
});
|
||||
|
||||
it("reads latest-ever-per-type one index probe per type, floored at one year", async () => {
|
||||
// Audit High finding 3 established the 365-day floor. The read is the
|
||||
// shared `readLatestEver`: driven from the type list, one LIMIT 1 probe
|
||||
// The read is floored at 365 days. It is the shared `readLatestEver`:
|
||||
// driven from the type list, one LIMIT 1 probe
|
||||
// per type, so a dense type never sorts a year of raw rows to keep one.
|
||||
await callGet(makeReq());
|
||||
|
||||
|
||||
@@ -20,7 +20,10 @@ import {
|
||||
} from "@/lib/managed-profiles/guardian-list";
|
||||
import { ManagedProfileLifecycleError } from "@/lib/managed-profiles/lifecycle";
|
||||
import { checkRateLimit } from "@/lib/rate-limit";
|
||||
import { GRANT_PARTY_SELECT } from "@/lib/sharing/grant-view";
|
||||
import {
|
||||
GRANT_PARTY_SELECT,
|
||||
INVITE_NO_ACCOUNT_CODE,
|
||||
} from "@/lib/sharing/grant-view";
|
||||
import { GrantError, inviteManagedProfileGuardian } from "@/lib/sharing/grants";
|
||||
import { inviteManagedProfileGuardianSchema } from "@/lib/validations/managed-profiles";
|
||||
|
||||
@@ -106,16 +109,16 @@ export const POST = apiHandler(
|
||||
},
|
||||
select: GRANT_PARTY_SELECT,
|
||||
});
|
||||
// No `errorCode`, deliberately, and the same for the 429 above. Rate-limit
|
||||
// refusals carry none anywhere in this application, and the sibling
|
||||
// invitation route (`POST /api/account/grants`) answers an unknown
|
||||
// identifier with a bare 404 too. A code here would make one route in the
|
||||
// family unlike both. The published contract says so, and says that a
|
||||
// client resolves on `meta.errorCode` FIRST: this route's other 404 —
|
||||
// "you are not a Guardian of that profile" — does carry one, and branching
|
||||
// on the status would tell somebody to check a spelling when the real
|
||||
// answer is that the profile is no longer theirs to administer.
|
||||
if (!invitee) return apiError("No account with that name or e-mail", 404);
|
||||
// The same code the sibling invitation route (`POST /api/account/grants`)
|
||||
// answers an unknown identifier with. This route has a second 404 — "you
|
||||
// are not a Guardian of that profile", `managed_profile.not_found` — and
|
||||
// the two need different next steps, so each names itself and a client
|
||||
// never has to tell them apart by status.
|
||||
if (!invitee) {
|
||||
return apiError("No account with that name or e-mail", 404, {
|
||||
errorCode: INVITE_NO_ACCOUNT_CODE,
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const grant = await inviteManagedProfileGuardian({
|
||||
|
||||
Reference in new issue
Block a user