관리자 미디어 라이브러리 기본 기능 추가
This commit is contained in:
16
server/routes/admin/api/media.put.js
Normal file
16
server/routes/admin/api/media.put.js
Normal file
@@ -0,0 +1,16 @@
|
||||
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 || '')
|
||||
})
|
||||
Reference in New Issue
Block a user