관리자 글 링크 참조 확인 추가

This commit is contained in:
2026-07-10 15:50:13 +09:00
parent e48f886956
commit d708381e09
9 changed files with 420 additions and 6 deletions

View File

@@ -0,0 +1,24 @@
import { createError, getRouterParam } from 'h3'
import { requireAdminSession } from '../../../../../utils/admin-auth'
import { listAdminPostReferences } from '../../../../../repositories/content-repository'
/**
* 관리자 게시물 참조 목록 API
* @param {import('h3').H3Event} event - 요청 이벤트
* @returns {Promise<{ target: { id: string, title: string, slug: string }, posts: Array }>} 참조 목록
*/
export default defineEventHandler(async (event) => {
requireAdminSession(event)
const id = getRouterParam(event, 'id')
const references = await listAdminPostReferences(id)
if (!references) {
throw createError({
statusCode: 404,
message: '게시물을 찾을 수 없습니다.'
})
}
return references
})