Important Fixes, New mechanics, and many more
Some checks failed
CI / validate (push) Failing after 9m21s

This commit is contained in:
2026-08-15 17:37:57 +05:00
parent 1774496cf9
commit 438e5af0ad
56 changed files with 5090 additions and 119 deletions

View File

@@ -0,0 +1,19 @@
import { createHash } from 'node:crypto'
import { z } from 'zod'
import { requireStageTwoUser, stageTwoApiError, stageTwoRpc } from '~/server/utils/stage-two-supabase'
const BodySchema = z.object({ token: z.string().trim().min(20).max(200) }).strict()
export default defineEventHandler(async (event) => {
try {
const user = await requireStageTwoUser(event)
const body = BodySchema.parse(await readBody(event))
const tokenHash = createHash('sha256').update(body.token).digest('hex')
const campaignId = await stageTwoRpc<string>('stage_two_join_campaign', {
p_token_hash: tokenHash, p_user_id: user.id,
})
return { campaignId }
} catch (error) {
stageTwoApiError(error)
}
})