태그를 관리용/일반용으로 분리하고 관리자 드래그 정렬을 추가.
댓글/회원/관리자 인증·프로필 흐름 보완과 관련 마이그레이션 및 문서를 함께 반영해 운영 동선을 안정화. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { listPostCommentsBySlug } from '../../../repositories/comment-repository'
|
||||
import { getMemberSession } from '../../../utils/member-auth'
|
||||
|
||||
/**
|
||||
* 게시물 댓글 목록 조회 API
|
||||
@@ -7,7 +8,8 @@ import { listPostCommentsBySlug } from '../../../repositories/comment-repository
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
const slug = String(getRouterParam(event, 'slug') || '')
|
||||
const comments = await listPostCommentsBySlug(slug)
|
||||
const session = getMemberSession(event)
|
||||
const comments = await listPostCommentsBySlug(slug, session?.userId || null)
|
||||
|
||||
return {
|
||||
comments
|
||||
|
||||
28
server/api/posts/[slug]/comments/[commentId]/like.post.js
Normal file
28
server/api/posts/[slug]/comments/[commentId]/like.post.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import { getRequestIP } from 'h3'
|
||||
import { toggleCommentLike } from '../../../../../repositories/comment-repository'
|
||||
import { touchUserActivity } from '../../../../../repositories/member-repository'
|
||||
import { requireMemberSession } from '../../../../../utils/member-auth'
|
||||
|
||||
/**
|
||||
* 댓글 좋아요 토글 API
|
||||
* @param {import('h3').H3Event} event - 요청 이벤트
|
||||
* @returns {Promise<{ liked: boolean, likeCount: number }>} 좋아요 상태
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
const session = requireMemberSession(event)
|
||||
const slug = String(getRouterParam(event, 'slug') || '')
|
||||
const commentId = String(getRouterParam(event, 'commentId') || '')
|
||||
|
||||
const result = await toggleCommentLike({
|
||||
slug,
|
||||
commentId,
|
||||
userId: session.userId
|
||||
})
|
||||
|
||||
await touchUserActivity({
|
||||
userId: session.userId,
|
||||
ip: String(getRequestIP(event) || '')
|
||||
})
|
||||
|
||||
return result
|
||||
})
|
||||
Reference in New Issue
Block a user