1 changed files with 12 additions and 0 deletions
@ -0,0 +1,12 @@ |
|||||
|
import { softDeleteComment } from "#server/service/post-comments"; |
||||
|
|
||||
|
export default defineWrappedResponseHandler(async (event) => { |
||||
|
const user = await event.context.auth.requireUser(); |
||||
|
const postId = Number(event.context.params?.postId); |
||||
|
const commentId = Number(event.context.params?.commentId); |
||||
|
if (!Number.isInteger(postId) || !Number.isInteger(commentId)) { |
||||
|
throw createError({ statusCode: 400, statusMessage: "无效请求" }); |
||||
|
} |
||||
|
await softDeleteComment({ postId, commentId, actorUserId: user.id }); |
||||
|
return R.success({ ok: true }); |
||||
|
}); |
||||
Loading…
Reference in new issue