Browse Source

feat(api): soft-delete comment from me scope

Made-with: Cursor
main
npmrun 5 hours ago
parent
commit
34cacdd43b
  1. 12
      server/api/me/posts/[postId]/comments/[commentId].delete.ts

12
server/api/me/posts/[postId]/comments/[commentId].delete.ts

@ -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…
Cancel
Save