Remove custom icon data from leaderboards response
This commit is contained in:
@@ -1,10 +1,6 @@
|
|||||||
import { Context } from 'elysia'
|
import { Context } from 'elysia'
|
||||||
import { getDatabaseConnection, jsonResponse } from '../../../lib/util'
|
import { getDatabaseConnection, jsonResponse } from '../../../lib/util'
|
||||||
import {
|
import { berryDashUserData, users } from '../../../lib/tables'
|
||||||
berryDashMarketplaceIcons,
|
|
||||||
berryDashUserData,
|
|
||||||
users
|
|
||||||
} from '../../../lib/tables'
|
|
||||||
import { eq } from 'drizzle-orm'
|
import { eq } from 'drizzle-orm'
|
||||||
|
|
||||||
export async function handler (context: Context, type: number) {
|
export async function handler (context: Context, type: number) {
|
||||||
@@ -81,7 +77,6 @@ export async function handler (context: Context, type: number) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
let mapped: Record<string, {}> = {}
|
let mapped: Record<string, {}> = {}
|
||||||
let icons: Record<string, string> = {}
|
|
||||||
for (const row of completeUserList) {
|
for (const row of completeUserList) {
|
||||||
const savedata = row.saveData ? JSON.parse(row.saveData) : null
|
const savedata = row.saveData ? JSON.parse(row.saveData) : null
|
||||||
if (!savedata) continue
|
if (!savedata) continue
|
||||||
@@ -113,17 +108,6 @@ export async function handler (context: Context, type: number) {
|
|||||||
|
|
||||||
const customIcon = savedata.bird?.customIcon?.selected ?? null
|
const customIcon = savedata.bird?.customIcon?.selected ?? null
|
||||||
|
|
||||||
if (customIcon && customIcon.length === 36 && !icons[customIcon]) {
|
|
||||||
const [iconRow] = await db1
|
|
||||||
.select({ data: berryDashMarketplaceIcons.data })
|
|
||||||
.from(berryDashMarketplaceIcons)
|
|
||||||
.where(eq(berryDashMarketplaceIcons.uuid, customIcon))
|
|
||||||
.limit(1)
|
|
||||||
.execute()
|
|
||||||
|
|
||||||
if (iconRow) icons[customIcon] = iconRow.data
|
|
||||||
}
|
|
||||||
|
|
||||||
mapped[row.id] = {
|
mapped[row.id] = {
|
||||||
username: row.username,
|
username: row.username,
|
||||||
value,
|
value,
|
||||||
@@ -141,6 +125,6 @@ export async function handler (context: Context, type: number) {
|
|||||||
return jsonResponse({
|
return jsonResponse({
|
||||||
success: true,
|
success: true,
|
||||||
message: null,
|
message: null,
|
||||||
data: { entries: mapped, customIcons: icons }
|
data: mapped
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user