mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 22:26:13 +00:00
Switch defaultLocale from "de" to "en" and make English the code-level language throughout. All ~145 hardcoded German strings translated: - API error messages (52 routes) now return English - Zod validation messages in English - Classification/analytics functions return English categories - Notification type labels in English - Component strings use i18n t() calls (heatmap, mood chart, medication form, intake history, password strength, insights card) - ~50 new i18n keys in both de.json and en.json Route migration: - /stimmung → /mood, /zielwerte → /targets (new pages) - 301 redirects in proxy.ts for legacy URLs - Sidebar + bottom nav updated Bump version to 1.0.1.
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { NextRequest } from "next/server";
|
|
import { prisma } from "@/lib/db";
|
|
import { apiHandler, requireAuth } from "@/lib/api-handler";
|
|
import { apiSuccess, apiError } from "@/lib/api-response";
|
|
import { annotate } from "@/lib/logging/context";
|
|
import { syncMoodLogEntries } from "@/lib/moodlog/sync";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export const POST = apiHandler(async (request: NextRequest) => {
|
|
const { user } = await requireAuth();
|
|
annotate({ action: { name: "moodlog.sync" } });
|
|
|
|
// Check global toggle
|
|
const appSettings = await prisma.appSettings.findUnique({
|
|
where: { id: "singleton" },
|
|
select: { moodLogGlobal: true },
|
|
});
|
|
if (appSettings && !appSettings.moodLogGlobal) {
|
|
return apiError("moodLog integration is disabled", 403);
|
|
}
|
|
|
|
let fullSync = false;
|
|
try {
|
|
const body = await request.json();
|
|
fullSync = body?.fullSync === true;
|
|
} catch {
|
|
// No body or invalid JSON — use defaults
|
|
}
|
|
|
|
const imported = await syncMoodLogEntries(user.id, {
|
|
fullSync,
|
|
});
|
|
return apiSuccess({ imported });
|
|
});
|