mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
Long-overdue prettier sweep; prettier had drifted vs. checked-in code across ~130 files (mostly long-argument line-break wrapping in TS and table-padding in markdown). Pure formatting — no semantic changes — and required to clear the v1.4.6 release gate's `pnpm format:check`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import {
|
|
apiSuccess,
|
|
apiError,
|
|
getClientIp,
|
|
safeJson,
|
|
} from "@/lib/api-response";
|
|
import { NextRequest } from "next/server";
|
|
import { apiHandler, requireAuth } from "@/lib/api-handler";
|
|
import { annotate } from "@/lib/logging/context";
|
|
import { applyProfileUpdate } from "@/lib/auth/profile-update";
|
|
|
|
export const PUT = apiHandler(async (request: NextRequest) => {
|
|
const { user } = await requireAuth();
|
|
|
|
const { data: body, error: jsonError } = await safeJson(request);
|
|
if (jsonError) return jsonError;
|
|
|
|
const result = await applyProfileUpdate(user.id, body, getClientIp(request));
|
|
if (!result.ok) {
|
|
return apiError(result.message, result.status);
|
|
}
|
|
|
|
annotate({ action: { name: "auth.profile.update" } });
|
|
|
|
return apiSuccess({
|
|
id: result.user.id,
|
|
username: result.user.username,
|
|
email: result.user.email,
|
|
role: result.user.role,
|
|
heightCm: result.user.heightCm,
|
|
dateOfBirth: result.user.dateOfBirth,
|
|
gender: result.user.gender,
|
|
timezone: result.user.timezone,
|
|
});
|
|
});
|