feat(settings): 扩展 SettingsData 加 compact 字段,后端解析与校验

This commit is contained in:
2026-06-06 22:37:22 +08:00
parent f4318c7643
commit 91ae52320b
5 changed files with 113 additions and 21 deletions

View File

@@ -32,6 +32,10 @@ export async function handleUpdateSettings(
return jsonResponse(createApiError("theme 仅支持 dark、light、system", 400), { mode, status: 400 });
}
if (body.compact !== undefined && typeof body.compact !== "boolean") {
return jsonResponse(createApiError("compact 必须为布尔值", 400), { mode, status: 400 });
}
const result = updateSettings(db, body, logger);
logger.info({ data: result }, "设置已更新");
return jsonResponse(result, { mode });