feat: auto-pin entries with ≥10 votes and ≥80% approval

This commit is contained in:
2026-05-09 22:32:19 +08:00
parent 8ea160bd05
commit 027d3ac8fc
2 changed files with 62 additions and 0 deletions
+11
View File
@@ -4,6 +4,7 @@ import { performanceEntries, games, gameVersions, hardware, user, gamePlatformSu
import { db } from "@/lib/db/index"
import { eq, and, desc, sql } from "drizzle-orm"
import { requireRole } from "@/lib/auth/guard"
import { checkAndAutoPin } from "./auto-pin"
// ── Performance Entries CRUD ──────────────────────────────────────
export const performanceRoutes = createCrudRoutes(performanceEntries, {
@@ -93,6 +94,11 @@ export const performanceVerifyRoutes = new Elysia({
return { error: "Performance entry not found" }
}
// Auto-pin check (fire and forget, result doesn't affect response)
checkAndAutoPin(updated.id).catch((err) =>
console.error("Auto-pin check failed:", err),
)
return updated
},
{
@@ -132,6 +138,11 @@ export const performanceVerifyRoutes = new Elysia({
return { error: "Performance entry not found" }
}
// Auto-pin check (fire and forget, result doesn't affect response)
checkAndAutoPin(updated.id).catch((err) =>
console.error("Auto-pin check failed:", err),
)
return updated
},
{