TypeScript 97.5%
SQL 1.4%
Python 0.8%
1"use server";23import { getDb, legalAcceptances } from "@fetcha/db";4import { newId } from "@fetcha/core";5import { getUser, requestMeta } from "@/lib/session";6import { LEGAL_VERSIONS } from "@/lib/legal-versions";789/** Record acceptance of Terms + Privacy (+ AUP) for the current user with version, timestamp and IP. */10export async function recordLegalAcceptance(): Promise<void> {11 const user = await getUser();12 if (!user) return;13 const meta = await requestMeta();14 const db = getDb();15 await db.insert(legalAcceptances).values(16 (Object.keys(LEGAL_VERSIONS) as Array<keyof typeof LEGAL_VERSIONS>).map((doc) => ({17 id: newId("evt"),18 userId: user.id,19 document: doc,20 version: LEGAL_VERSIONS[doc],21 ipAddress: meta.ip,22 })),23 );24}25