Files
buzz/app/widget/donate/goal/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

22 lines
605 B
TypeScript

"use server";
import { gt, sum } from "drizzle-orm";
import { getArtifactConfig } from "@/lib/api";
import { db } from "@/lib/db";
import { donations, settings } from "@/lib/db/schema";
export async function getDonateBar() {
const { donateGoalStarting } = await getArtifactConfig();
const [{ amount }] = await db
.select({
amount: sum(donations.amount),
})
.from(donations)
.where(gt(donations.created, donateGoalStarting ?? new Date(0)));
const [{ goal }] = await db
.select({ goal: settings.donateGoal })
.from(settings)
.limit(1);
return { amount, goal };
}