mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 06:40:50 +00:00
List only the sources an account uses on the source-priority page
The read and save of /api/auth/me/source-priority now carry inUse: the ranked sources the account has connected or holds at least one measurement from, one index probe per source. The settings page lists only those, hides a metric nothing delivers, and opens one metric group at a time, the first by default, with the winning source named on each collapsed line. The ladders stay whole: moving a source swaps it with its nearest listed neighbour, so a hidden source keeps its slot.
This commit is contained in:
1 parent
c816946140
commit
51374274aa
15 files changed
+956
-1475
No files matched your search
@@ -9,6 +9,7 @@ import { z } from "zod/v4";
|
||||
import type { ZodOpenApiObject } from "zod-openapi";
|
||||
import { notificationPrefsSchema } from "@/lib/validations/notification-prefs";
|
||||
import { sourcePrioritySchema } from "@/lib/validations/source-priority";
|
||||
import { measurementSourceEnum } from "@/lib/validations/measurement";
|
||||
import { modulePrefsPatchSchema } from "@/lib/validations/modules";
|
||||
import { MODULE_KEYS } from "@/lib/modules/registry";
|
||||
import {
|
||||
@@ -204,6 +205,21 @@ export const aiAccountBlock = z
|
||||
"Which AI capabilities the record this session is inside has, and why not when it has none. Resolved on the server for the ACTIVE RECORD and masked to the sections the active grant opens, exactly like `modules` and `moduleAccess`; with no switch (every native request) it describes the caller's own record.",
|
||||
});
|
||||
|
||||
/**
|
||||
* The source-priority read and save both echo the resolved ladders plus
|
||||
* `inUse`: the ranked sources the account has connected or holds data from.
|
||||
* Context for an editor, never part of the stored shape (the PUT body stays
|
||||
* `SourcePriority`).
|
||||
*/
|
||||
const sourcePriorityResolved = sourcePrioritySchema
|
||||
.extend({
|
||||
inUse: z.array(measurementSourceEnum).meta({
|
||||
description:
|
||||
"Ranked sources this account has connected or holds at least one measurement from, in ladder-catalogue order. Read-only; an editor may list only these while the ladders keep every source.",
|
||||
}),
|
||||
})
|
||||
.meta({ id: "ResolvedSourcePriority" });
|
||||
|
||||
const moduleMapEnvelopeInner = z
|
||||
.object({ modules: moduleMapResolved, updatedAt: updatedAtTokenField })
|
||||
.meta({ id: "ModulesResponse" });
|
||||
@@ -1425,7 +1441,7 @@ export const profilePaths: NonNullable<ZodOpenApiObject["paths"]> = {
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: dataEnvelope(
|
||||
sourcePrioritySchema,
|
||||
sourcePriorityResolved,
|
||||
"GetSourcePriorityResponse",
|
||||
),
|
||||
},
|
||||
@@ -1449,7 +1465,7 @@ export const profilePaths: NonNullable<ZodOpenApiObject["paths"]> = {
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: dataEnvelope(
|
||||
sourcePrioritySchema,
|
||||
sourcePriorityResolved,
|
||||
"PutSourcePriorityResponse",
|
||||
),
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user