badges improvements
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user