Introduce units preference

This commit is contained in:
2025-04-25 18:44:18 +03:00
parent f8c9332e47
commit ceb587d2f8
4 changed files with 6 additions and 0 deletions

View File

@@ -18,3 +18,5 @@ export const tones = ref([
"Adventure", "Adventure",
"Snarky", "Snarky",
]); ]);
export const units = ref(["Imperial", "Metric"]);

View File

@@ -10,6 +10,7 @@ export default defineEventHandler(async (event) => {
enabled: body.enabled, enabled: body.enabled,
language: body.language, language: body.language,
tone: body.tone, tone: body.tone,
units: body.units,
}, },
}) })
.where(eq(tables.preferences.userId, session.user.id)) .where(eq(tables.preferences.userId, session.user.id))

View File

@@ -33,11 +33,13 @@ export const preferences = pgTable("preferences", {
enabled: boolean; enabled: boolean;
language: string; language: string;
tone: string; tone: string;
units: "Imperial" | "Metric";
}>() }>()
.$defaultFn(() => ({ .$defaultFn(() => ({
enabled: true, enabled: true,
language: "English", language: "English",
tone: "Casual", tone: "Casual",
units: "Metric",
})), })),
}); });

View File

@@ -70,6 +70,7 @@ export default defineOAuthStravaEventHandler({
enabled: true, enabled: true,
language: "English", language: "English",
tone: "Casual", tone: "Casual",
units: "Metric",
}, },
}) })
.onConflictDoNothing(); .onConflictDoNothing();