mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
fix(medications): page the side-effect list and name every GLP-1 medication in the timeline
This commit is contained in:
1 parent
53e60f43f1
commit
7c905249fb
13 files changed
+228
-33
No files matched your search
@@ -68,7 +68,7 @@ export const GET = apiHandler(async (request: NextRequest) => {
|
||||
});
|
||||
|
||||
if (meds.length === 0) {
|
||||
return apiSuccess({ hasGlp1: false, entries: [] });
|
||||
return apiSuccess({ hasGlp1: false, entries: [], medications: [] });
|
||||
}
|
||||
|
||||
const ninetyDaysAgo = new Date();
|
||||
@@ -173,5 +173,12 @@ export const GET = apiHandler(async (request: NextRequest) => {
|
||||
},
|
||||
});
|
||||
|
||||
return apiSuccess({ hasGlp1: true, entries: entries.slice(0, limit) });
|
||||
// `medications` is every GLP-1 medication, independent of `limit`: a
|
||||
// consumer that needs the set (the substance-curve summary) must not
|
||||
// derive it from a capped page of entries.
|
||||
return apiSuccess({
|
||||
hasGlp1: true,
|
||||
entries: entries.slice(0, limit),
|
||||
medications: meds.map((med) => ({ id: med.id, name: med.name })),
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user