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

19 lines
440 B
TypeScript

"use server";
import { asc, desc, max, sum } from "drizzle-orm";
import { db } from "@/lib/db";
import { donations } from "@/lib/db/schema";
export async function getTopDonate() {
const [top] = await db
.select({
name: donations.name,
amount: sum(donations.amount),
})
.from(donations)
.limit(1)
.groupBy(donations.name)
.orderBy(desc(sum(donations.amount)), asc(max(donations.id)));
return top;
}