You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
589 B

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,
},
});
});