Files
sori.studio/server/api/posts/[slug]/comments.get.js
zenn cdc16c72b2 태그를 관리용/일반용으로 분리하고 관리자 드래그 정렬을 추가.
댓글/회원/관리자 인증·프로필 흐름 보완과 관련 마이그레이션 및 문서를 함께 반영해 운영 동선을 안정화.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 18:34:23 +09:00

19 lines
580 B
JavaScript

import { listPostCommentsBySlug } from '../../../repositories/comment-repository'
import { getMemberSession } from '../../../utils/member-auth'
/**
* 게시물 댓글 목록 조회 API
* @param {import('h3').H3Event} event - 요청 이벤트
* @returns {Promise<{ comments: Array<Object> }>} 댓글 목록
*/
export default defineEventHandler(async (event) => {
const slug = String(getRouterParam(event, 'slug') || '')
const session = getMemberSession(event)
const comments = await listPostCommentsBySlug(slug, session?.userId || null)
return {
comments
}
})