미디어 카탈로그 관찰 모드 정리
This commit is contained in:
@@ -226,17 +226,6 @@ export const createPagedMediaResponse = (items, query) => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 미디어 목록의 민감정보 없는 비교 수치를 만든다.
|
||||
* @param {Array<Object>} items - 미디어 항목 목록
|
||||
* @returns {{ count: number, bytes: number, kinds: Record<string, number> }} 비교 수치
|
||||
*/
|
||||
const createMediaComparisonSummary = (items) => ({
|
||||
count: items.length,
|
||||
bytes: items.reduce((total, item) => total + Number(item.size || 0), 0),
|
||||
kinds: countMediaKinds(items)
|
||||
})
|
||||
|
||||
/**
|
||||
* 관리자 미디어 목록 API
|
||||
* @param {import('h3').H3Event} event - 요청 이벤트
|
||||
@@ -272,23 +261,6 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
} else {
|
||||
items = await listMediaItems()
|
||||
|
||||
if (mode === 'shadow') {
|
||||
listMediaCatalogItems().then((catalogItems) => {
|
||||
const filesystem = createMediaComparisonSummary(items)
|
||||
const catalog = createMediaComparisonSummary(catalogItems)
|
||||
console.info('[media-catalog] shadow 차이', {
|
||||
count: catalog.count - filesystem.count,
|
||||
bytes: catalog.bytes - filesystem.bytes,
|
||||
kinds: Object.fromEntries(Object.keys(filesystem.kinds).map((kind) => [
|
||||
kind,
|
||||
Number(catalog.kinds[kind] || 0) - Number(filesystem.kinds[kind] || 0)
|
||||
]))
|
||||
})
|
||||
}).catch(() => {
|
||||
console.warn('[media-catalog] shadow 비교 실패')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (paged) {
|
||||
|
||||
Reference in New Issue
Block a user