17 lines
503 B
JavaScript
17 lines
503 B
JavaScript
import { readBody } from 'h3'
|
|
import { requireAdminSession } from '../../../utils/admin-auth'
|
|
import { renameMediaItem } from '../../../utils/media-library'
|
|
|
|
/**
|
|
* 관리자 미디어 파일명 변경 API
|
|
* @param {import('h3').H3Event} event - 요청 이벤트
|
|
* @returns {Promise<Object>} 변경된 미디어 항목
|
|
*/
|
|
export default defineEventHandler(async (event) => {
|
|
requireAdminSession(event)
|
|
|
|
const body = await readBody(event)
|
|
|
|
return renameMediaItem(body?.url, body?.name || '')
|
|
})
|