Add downloads count

This commit is contained in:
2026-02-03 17:41:03 -07:00
parent 4cc0ff910d
commit 294339a39e
4 changed files with 42 additions and 3 deletions

View File

@@ -0,0 +1,21 @@
import { Context } from 'elysia'
import { launcherVersionManifest } from '../../lib/tables'
import { getDatabaseConnection } from '../../lib/util'
import { eq, sql } from 'drizzle-orm'
export async function handler (context: Context) {
const dbResult = getDatabaseConnection(0)
if (!dbResult) return null
const { connection, db } = dbResult
await db
.update(launcherVersionManifest)
.set({
downloads: sql`${launcherVersionManifest.downloads} + 1`
})
.where(eq(launcherVersionManifest.id, context.query.id))
connection.end()
return null
}