메뉴 관리 기능 추가
This commit is contained in:
24
server/routes/admin/api/navigation.put.js
Normal file
24
server/routes/admin/api/navigation.put.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { createError, readBody } from 'h3'
|
||||
import { requireAdminSession } from '../../../utils/admin-auth'
|
||||
import { parseAdminNavigationInput } from '../../../utils/admin-navigation-input'
|
||||
import { updateNavigationItems } from '../../../repositories/content-repository'
|
||||
|
||||
/**
|
||||
* 관리자 네비게이션 일괄 저장 API
|
||||
* @param {import('h3').H3Event} event - 요청 이벤트
|
||||
* @returns {Promise<Array>} 저장된 네비게이션 항목 목록
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
requireAdminSession(event)
|
||||
|
||||
const parsedBody = parseAdminNavigationInput(await readBody(event))
|
||||
|
||||
if (!parsedBody.success) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
message: '네비게이션 입력 형식이 올바르지 않습니다.'
|
||||
})
|
||||
}
|
||||
|
||||
return updateNavigationItems(parsedBody.data.items)
|
||||
})
|
||||
Reference in New Issue
Block a user