Files
api/src/routes/launcher/download.ts
2026-02-03 17:41:03 -07:00

22 lines
576 B
TypeScript

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
}