badges improvements

This commit is contained in:
2026-08-23 20:31:44 -07:00
parent d9ccd5acf1
commit 3761f8be6f
9 changed files with 366 additions and 76 deletions
+8 -5
View File
@@ -4,6 +4,7 @@ import { createServerFn } from "@tanstack/react-start";
import { pbAdmin } from "@/lib/pocketbase/client";
import { z } from "zod";
import { emitServerEvent } from "@/lib/events/emitter";
import { getBadgeMigrationJobStatus, startBadgeMigration } from "./migration.server";
export const getPlayerBadges = createServerFn()
.validator(z.string())
@@ -15,11 +16,13 @@ export const getPlayerBadges = createServerFn()
export const migrateBadgeProgress = createServerFn()
.middleware([superTokensAdminFunctionMiddleware])
.handler(async () =>
toServerResult(async () => {
const result = await pbAdmin.migrateBadgeProgress();
emitServerEvent({ type: "badge" });
return result;
})
toServerResult(async () => startBadgeMigration())
);
export const getBadgeMigrationStatus = createServerFn()
.middleware([superTokensAdminFunctionMiddleware])
.handler(async () =>
toServerResult(async () => getBadgeMigrationJobStatus())
);
export const getAllBadges = createServerFn()