feat: implement PocketBase database schema setup script and core API service for content management
All checks were successful
On Push to Main / test (push) Successful in 29s
On Push to Main / publish (push) Successful in 59s
On Push to Main / deploy-dev (push) Successful in 1m33s

This commit is contained in:
RaymondVerhoef
2026-05-17 14:18:26 +02:00
parent 1bc51b3cb6
commit 775c3030d5
6 changed files with 38 additions and 4 deletions

View File

@@ -205,7 +205,8 @@ export async function setLearnDone(userId, weekNumber) {
// ── Leaderboard ───────────────────────────────────────────────────────────────
export async function getLeaderboard() {
return pb.collection('leaderboard').getFullList({ sort: '-points' });
const entries = await pb.collection('leaderboard').getFullList();
return entries.sort((a, b) => (b.points || 0) - (a.points || 0));
}
export async function upsertLeaderboardEntry(userId, name, pointsDelta, testsCompletedDelta = 0) {