fix: restore admin ebay refresh via public convex action wrapper
This commit is contained in:
parent
1f46c2b390
commit
5b6ad66c24
2 changed files with 16 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import { NextResponse } from "next/server"
|
import { NextResponse } from "next/server"
|
||||||
import { fetchAction } from "convex/nextjs"
|
import { fetchAction } from "convex/nextjs"
|
||||||
import { internal } from "@/convex/_generated/api"
|
import { api } from "@/convex/_generated/api"
|
||||||
import { requireAdminToken } from "@/lib/server/admin-auth"
|
import { requireAdminToken } from "@/lib/server/admin-auth"
|
||||||
|
|
||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
|
|
@ -10,7 +10,7 @@ export async function POST(request: Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await fetchAction(internal.ebay.refreshCache, {
|
const result = await fetchAction(api.ebay.refreshCacheAdmin, {
|
||||||
reason: "admin",
|
reason: "admin",
|
||||||
force: true,
|
force: true,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { internalAction, internalMutation, query } from "./_generated/server"
|
import { action, internalAction, internalMutation, query } from "./_generated/server"
|
||||||
import { api, internal } from "./_generated/api"
|
import { api, internal } from "./_generated/api"
|
||||||
import { v } from "convex/values"
|
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({
|
export const upsertPollResult = internalMutation({
|
||||||
args: {
|
args: {
|
||||||
key: v.string(),
|
key: v.string(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue