feat: 미사용 이미지 기준과 관리자 자산 정리 통합
This commit is contained in:
@@ -175,18 +175,26 @@ export function useAdminCustomItems({
|
||||
|
||||
async function removeUnusedCustomItems() {
|
||||
resetMessages()
|
||||
const ok = window.confirm('현재 검색 조건에 맞는 미사용 커스텀 이미지를 모두 삭제할까요?')
|
||||
const ok = window.confirm('현재 검색 조건에 맞는 미사용 이미지를 모두 삭제할까요?')
|
||||
if (!ok) return
|
||||
|
||||
try {
|
||||
const data = await api.deleteAdminUnusedCustomItems({ q: customItemQuery.value })
|
||||
await refreshCustomItems()
|
||||
success.value = `${data.deletedCount || 0}개의 미사용 사용자 업로드 이미지를 삭제했어요.`
|
||||
success.value = `${data.deletedCount || 0}개의 미사용 이미지를 삭제했어요.`
|
||||
} catch (e) {
|
||||
error.value = '미사용 커스텀 이미지 일괄 삭제에 실패했어요.'
|
||||
error.value = '미사용 이미지 일괄 삭제에 실패했어요.'
|
||||
}
|
||||
}
|
||||
|
||||
function showUnusedCustomItems() {
|
||||
if (customItemFilter.value === 'unused') return
|
||||
resetMessages()
|
||||
customItemFilter.value = 'unused'
|
||||
customItemPage.value = 1
|
||||
refreshCustomItems()
|
||||
}
|
||||
|
||||
async function saveCustomItemModalLabel() {
|
||||
const item = modalTargetCustomItem.value
|
||||
const nextLabel = customItemModalDraftLabel.value.trim().slice(0, 60)
|
||||
@@ -291,6 +299,7 @@ export function useAdminCustomItems({
|
||||
jumpToTemplateAdmin,
|
||||
removeCustomItem,
|
||||
removeUnusedCustomItems,
|
||||
showUnusedCustomItems,
|
||||
saveCustomItemModalLabel,
|
||||
promoteCustomItem,
|
||||
refreshReplacementCandidates,
|
||||
|
||||
@@ -657,12 +657,14 @@ const visibleLinkedTemplates = computed(() =>
|
||||
const linkedCustomItemTemplateIds = computed(() => new Set(visibleLinkedTemplates.value.map((template) => template.id).filter(Boolean)))
|
||||
const canReplaceModalTarget = computed(() => modalTargetCustomItem.value?.sourceType === 'user')
|
||||
const replacementCandidateCount = computed(() => customItemReplacementItems.value.length)
|
||||
const hasDeletableUnusedCustomItems = computed(() =>
|
||||
const hasDeletableUnusedItems = computed(() =>
|
||||
customItems.value.some(
|
||||
(item) =>
|
||||
item?.sourceType === 'user' &&
|
||||
(!!item.replacedAt ||
|
||||
(Number(item.usageCount || 0) === 0 && !(Array.isArray(item.linkedTemplates) && item.linkedTemplates.length > 0)))
|
||||
(item?.sourceType === 'user' &&
|
||||
(!!item.replacedAt ||
|
||||
(Number(item.usageCount || 0) === 0 && !(Array.isArray(item.linkedTemplates) && item.linkedTemplates.length > 0)))) ||
|
||||
item?.sourceType === 'asset' ||
|
||||
!!item?.isAssetLibraryItem
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1057,6 +1059,7 @@ const {
|
||||
jumpToTemplateAdmin,
|
||||
removeCustomItem,
|
||||
removeUnusedCustomItems,
|
||||
showUnusedCustomItems,
|
||||
saveCustomItemModalLabel,
|
||||
promoteCustomItem,
|
||||
refreshReplacementCandidates,
|
||||
@@ -2457,12 +2460,20 @@ function openUserProfile(user) {
|
||||
<option value="replaced-user">대체된 아이템</option>
|
||||
<option value="thumbnail">썸네일 이미지</option>
|
||||
<option value="avatar">프로필 이미지</option>
|
||||
<option value="unused-user">미사용 아이템</option>
|
||||
<option value="unused">미사용 이미지</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="adminSidebar__actions">
|
||||
<button class="btn btn--ghost" @click="refreshCustomItems">새로고침</button>
|
||||
<button class="btn btn--danger" :disabled="customItemFilter !== 'unused-user' || !hasDeletableUnusedCustomItems" @click="removeUnusedCustomItems">미사용 아이템 일괄 삭제</button>
|
||||
<button
|
||||
v-if="customItemFilter === 'unused'"
|
||||
class="btn btn--danger"
|
||||
:disabled="!hasDeletableUnusedItems"
|
||||
@click="removeUnusedCustomItems"
|
||||
>
|
||||
미사용 이미지 일괄 삭제
|
||||
</button>
|
||||
<button v-else class="btn btn--ghost" @click="showUnusedCustomItems">미사용 이미지 확인</button>
|
||||
</div>
|
||||
<div class="adminSidebar__stats">
|
||||
<div class="sidebarStat">
|
||||
|
||||
Reference in New Issue
Block a user