Add missing admin action files and navigation links

- Add 11 missing server action files: badges, bulk-users, catalog, catalog-bc, catalog-items, import-badges, import-furni, multi-account-detect, permissions, rooms, soundtracks
- Add missing admin navigation links: tickets, sounds, translations, import, radio sub-pages
- Add translation keys for all new navigation items
This commit is contained in:
openhands committed 2026-07-11 12:01:05 +02:00
1 parent 7e1ae17a3b
commit 41be6835bf
347 files changed
+28378 -6091

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
import { notFound } from 'next/navigation'
import { prisma } from '@/lib/prisma'
export async function loadUserById(id: string) {
const numericId = parseInt(id, 10)
const isNumeric = !Number.isNaN(numericId) && String(numericId) === id
const user = await prisma.user.findUnique({
where: isNumeric ? { id: numericId } : { username: id },
include: {
permission: true,
settings: true,
currencies: true,
badges: true,
bansReceived: {
include: { staff: { select: { username: true } } },
orderBy: { id: 'desc' },
take: 5,
},
},
})
if (!user) notFound()
const diamonds = user.currencies.find((c) => c.type === 5)?.amount ?? 0
const duckets = user.currencies.find((c) => c.type === 0)?.amount ?? 0
const [roomCount, chatCount, tradeCount, userRooms, chatLogs, commandLogs] = await Promise.all([
prisma.room.count({ where: { ownerId: user.id } }),
prisma.chatLog.count({ where: { userId: user.id } }),
prisma.trade.count({
where: { OR: [{ userOneId: user.id }, { userTwoId: user.id }] },
}),
prisma.room.findMany({
where: { ownerId: user.id },
orderBy: { users: 'desc' },
take: 20,
select: { id: true, name: true, state: true, users: true, usersMax: true },
}),
prisma.chatLog.findMany({
where: { userId: user.id },
orderBy: { id: 'desc' },
take: 20,
select: { id: true, roomId: true, timestamp: true, message: true },
}),
prisma.commandLog.findMany({
where: { userId: user.id },
orderBy: { id: 'desc' },
take: 10,
select: { id: true, timestamp: true, command: true, params: true, succes: true },
}),
])
const isOnline = user.online === '1'
const activeBan = user.bansReceived.find((b) => {
const now = Math.floor(Date.now() / 1000)
return b.banExpire === 0 || b.banExpire > now
})
return {
user,
diamonds,
duckets,
roomCount,
chatCount,
tradeCount,
userRooms,
chatLogs,
commandLogs: commandLogs.map((l) => ({ ...l, succes: String(l.succes) })),
isOnline,
activeBan,
}
}