아이템 관리 자산 분류와 기본 필터를 정리한다
This commit is contained in:
@@ -201,6 +201,14 @@ function getUserAccountName(row) {
|
||||
return email.split('@')[0] || email
|
||||
}
|
||||
|
||||
function getAssetLibrarySourceLabel(src) {
|
||||
const normalizedSrc = String(src || '').trim()
|
||||
if (normalizedSrc.includes('/uploads/assets/avatars/')) return '프로필 아바타'
|
||||
if (normalizedSrc.includes('/uploads/assets/tierlists/')) return '티어표 썸네일'
|
||||
if (normalizedSrc.includes('/uploads/assets/topics/')) return '템플릿 썸네일'
|
||||
return '보관 자산'
|
||||
}
|
||||
|
||||
async function createPool() {
|
||||
const rootConnection = await mysql.createConnection({
|
||||
host: DB_HOST,
|
||||
@@ -1857,8 +1865,8 @@ async function listCustomItems({ queryText = '', page = 1, limit = 50, filterMod
|
||||
ownerEmail: '',
|
||||
usageCount: 0,
|
||||
linkedTemplates: [],
|
||||
sourceType: 'template',
|
||||
sourceLabel: '관리자 템플릿',
|
||||
sourceType: 'asset',
|
||||
sourceLabel: getAssetLibrarySourceLabel(row.src),
|
||||
canDelete: true,
|
||||
sourceTopicId: '',
|
||||
sourceTopicName: '',
|
||||
@@ -1900,7 +1908,7 @@ async function listCustomItems({ queryText = '', page = 1, limit = 50, filterMod
|
||||
|
||||
siblings.forEach((entry) => {
|
||||
if (entry.sourceType === 'user') userReferenceCount += 1
|
||||
else if (entry.isAssetLibraryItem) assetReferenceCount += 1
|
||||
else if (entry.sourceType === 'asset' || entry.isAssetLibraryItem) assetReferenceCount += 1
|
||||
else templateReferenceCount += 1
|
||||
;(entry.linkedTemplates || []).forEach((template) => {
|
||||
if (template?.id) linkedTemplates.set(template.id, template)
|
||||
@@ -1939,11 +1947,13 @@ async function listCustomItems({ queryText = '', page = 1, limit = 50, filterMod
|
||||
case 'template':
|
||||
return item.sourceType === 'template' && !item.isAssetLibraryItem
|
||||
case 'asset':
|
||||
return !!item.isAssetLibraryItem
|
||||
return item.sourceType === 'asset' || !!item.isAssetLibraryItem
|
||||
case 'library':
|
||||
return item.sourceType === 'user' || (item.sourceType === 'template' && !item.isAssetLibraryItem)
|
||||
case 'unused-user':
|
||||
return item.sourceType === 'user' && item.usageCount === 0 && item.linkedTemplates.length === 0
|
||||
case 'unused-admin':
|
||||
return !!item.isAssetLibraryItem
|
||||
return item.sourceType === 'asset' || !!item.isAssetLibraryItem
|
||||
default:
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user