릴리스: v1.3.70 관리자 티어표 필터와 관리 액션 보강

This commit is contained in:
2026-04-02 15:28:52 +09:00
parent badf250967
commit a7cfb97131
8 changed files with 246 additions and 17 deletions

View File

@@ -1951,22 +1951,32 @@ function getAutoThumbnailSrc(groups = [], pool = []) {
return fallbackItem?.src || ''
}
async function listAdminTierLists({ queryText = '', page = 1, limit = 50, currentUserId = '' } = {}) {
async function listAdminTierLists({ queryText = '', gameId = '', page = 1, limit = 50, currentUserId = '' } = {}) {
const normalizedLimit = Math.min(Math.max(Number(limit) || 50, 1), 200)
const normalizedPage = Math.max(Number(page) || 1, 1)
const hasQuery = !!(queryText || '').trim()
const hasGameId = !!(gameId || '').trim()
const search = `%${(queryText || '').trim()}%`
const whereClause = hasQuery
? `
WHERE
t.title LIKE ?
OR g.name LIKE ?
OR g.id LIKE ?
OR u.email LIKE ?
OR u.nickname LIKE ?
`
: ''
const params = hasQuery ? [search, search, search, search, search] : []
const whereParts = []
const params = []
if (hasGameId) {
whereParts.push('t.game_id = ?')
params.push((gameId || '').trim())
}
if (hasQuery) {
whereParts.push(`(
t.title LIKE ?
OR g.name LIKE ?
OR g.id LIKE ?
OR u.email LIKE ?
OR u.nickname LIKE ?
)`)
params.push(search, search, search, search, search)
}
const whereClause = whereParts.length ? `WHERE ${whereParts.join(' AND ')}` : ''
const rows = await query(
`
@@ -2288,6 +2298,18 @@ async function deleteTierList(id) {
await query('DELETE FROM tierlists WHERE id = ?', [id])
}
async function updateAdminTierListMeta({ id, title, description = '', isPublic }) {
await query(
`
UPDATE tierlists
SET title = ?, description = ?, is_public = ?, updated_at = ?
WHERE id = ?
`,
[title, description || '', isPublic ? 1 : 0, now(), id]
)
return findTierListById(id)
}
async function findCustomItemsByIds(ids) {
if (!ids.length) return []
const placeholders = ids.map(() => '?').join(', ')
@@ -2454,6 +2476,7 @@ module.exports = {
listAdminTierLists,
summarizeAdminTierLists,
findTierListById,
updateAdminTierListMeta,
favoriteTierList,
unfavoriteTierList,
favoriteGame,