sql server + platine v2
All checks were successful
Deploy App / build (push) Successful in 2m15s
Deploy App / deploy (push) Successful in 27s

This commit is contained in:
valere
2026-02-06 22:52:02 +01:00
parent b8cc3d277d
commit 7fa6f6ccc8
14 changed files with 960 additions and 31 deletions

15
server/api/card/random.ts Normal file
View File

@@ -0,0 +1,15 @@
import { useDB, schema } from '../../db'
import { sql } from 'drizzle-orm'
export default defineEventHandler(async (event) => {
const db = useDB()
const count = await db
.select({ count: sql<number>`count(*)` })
.from(schema.cards)
.get()
const randomOffset = Math.floor(Math.random() * count.count)
const randomCard = await db.select().from(schema.cards).limit(1).offset(randomOffset).get()
return randomCard
})