Files
buzz/app/widget/donate/api.ts
T
dmgnr 4559f4693c
Build and Push Image / build-backend (push) Successful in 2m13s
Build and Push Image / build-frontend (push) Successful in 4m9s
Build and Push Image / push (push) Successful in 4m21s
refactor(host): migrate from docker swarm to kubernetes
2026-06-19 18:18:17 +00:00

30 lines
738 B
TypeScript

"use server";
import { eq } from "drizzle-orm";
import { db } from "@/lib/db";
import { donations } from "@/lib/db/schema";
import { getPostHogClient } from "@/lib/posthog-server";
export async function markRunning(id: string) {
getPostHogClient().capture({
distinctId: id,
event: "donation_widget_state_playing",
properties: { donation_id: id },
});
await db
.update(donations)
.set({ lastPing: new Date() })
.where(eq(donations.id, id));
}
export async function markDone(id: string) {
getPostHogClient().capture({
distinctId: id,
event: "donation_widget_state_shown",
properties: { donation_id: id },
});
await db.update(donations).set({ sent: true }).where(eq(donations.id, id));
}