import { upsertQuickNoteByUserId } from "#server/service/quick-note"; export default defineWrappedResponseHandler(async (event) => { const user = await event.context.auth.requireUser(); const body = await readBody<{ content?: unknown }>(event); if (typeof body?.content !== "string") { throw createError({ statusCode: 400, statusMessage: "content 必须为字符串" }); } const quickNote = await upsertQuickNoteByUserId(user.id, body.content); return R.success({ quickNote: { content: quickNote.content, updatedAt: quickNote.updatedAt, }, }); });