🎉 init

This commit is contained in:
2026-07-01 15:43:18 +02:00
commit 2f492c55be
64 changed files with 11645 additions and 0 deletions
@@ -0,0 +1,17 @@
import { useDb } from '../../../database/client'
import { participants } from '../../../database/schema'
export default defineEventHandler(async (event) => {
const slug = getRouterParam(event, 'slug')!
await getPotOrThrow(slug)
const body = await readBody(event)
const name = typeof body?.name === 'string' ? body.name.trim() : ''
if (!name) {
throw createError({ statusCode: 400, statusMessage: 'name is required' })
}
const db = useDb()
const [participant] = await db.insert(participants).values({ potSlug: slug, name }).returning()
return participant
})