mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
chore(units): drop the preference loader nothing calls yet
This commit is contained in:
1 parent
9a282ed698
commit
a1fa84dcdf
1 file changed
-26
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* Server-side read of a record's two unit preferences.
|
||||
*
|
||||
* Every text the server writes for a person to read — a status note, a period
|
||||
* narrative, a score label — quotes numbers, and a number is only right in the
|
||||
* unit its reader chose. This is the one read those producers share, so none
|
||||
* of them can load `unitPreference` and forget `glucoseUnit` or the reverse.
|
||||
*/
|
||||
import { prisma } from "@/lib/db";
|
||||
|
||||
import {
|
||||
DEFAULT_UNIT_PREFERENCES,
|
||||
resolveUnitPreferences,
|
||||
type UnitPreferences,
|
||||
} from "./display-transform";
|
||||
|
||||
/** Both preferences of one record; the defaults when the row is gone. */
|
||||
export async function loadUnitPreferences(
|
||||
userId: string,
|
||||
): Promise<UnitPreferences> {
|
||||
const row = await prisma.user.findUnique({
|
||||
where: { id: userId },
|
||||
select: { unitPreference: true, glucoseUnit: true },
|
||||
});
|
||||
return row ? resolveUnitPreferences(row) : DEFAULT_UNIT_PREFERENCES;
|
||||
}
|
||||
Reference in new issue
Block a user