fix: restore admin ebay refresh via public convex action wrapper

This commit is contained in:
DMleadgen 2026-04-10 16:01:00 -06:00
parent 1f46c2b390
commit 5b6ad66c24
Signed by: matt
GPG key ID: C2720CF8CD701894
2 changed files with 16 additions and 3 deletions

View file

@ -1,6 +1,6 @@
import { NextResponse } from "next/server"
import { fetchAction } from "convex/nextjs"
import { internal } from "@/convex/_generated/api"
import { api } from "@/convex/_generated/api"
import { requireAdminToken } from "@/lib/server/admin-auth"
export async function POST(request: Request) {
@ -10,7 +10,7 @@ export async function POST(request: Request) {
}
try {
const result = await fetchAction(internal.ebay.refreshCache, {
const result = await fetchAction(api.ebay.refreshCacheAdmin, {
reason: "admin",
force: true,
})

View file

@ -1,5 +1,5 @@
// @ts-nocheck
import { internalAction, internalMutation, query } from "./_generated/server"
import { action, internalAction, internalMutation, query } from "./_generated/server"
import { api, internal } from "./_generated/api"
import { v } from "convex/values"
@ -531,6 +531,19 @@ export const refreshCache = internalAction({
},
})
export const refreshCacheAdmin = action({
args: {
reason: v.optional(v.string()),
force: v.optional(v.boolean()),
},
handler: async (ctx, args) => {
return await ctx.runAction(internal.ebay.refreshCache, {
reason: args.reason,
force: args.force,
})
},
})
export const upsertPollResult = internalMutation({
args: {
key: v.string(),