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",
"Snarky",
]);
export const units = ref(["Imperial", "Metric"]);

View File

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

View File

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

View File

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