import { z } from 'zod' import { backfillXiaoyiDeliveriesForTarget } from '@/lib/external-auto-listing' import { autoListingFailure, autoListingResponse, targetIdSchema, withAutoListingSuperAdmin } from '../_shared' const backfillSchema = z.object({ id: targetIdSchema, limit: z.number().int().min(1).max(500).optional(), }).strict() export async function POST(request: Request) { return withAutoListingSuperAdmin(async () => { const result = backfillSchema.safeParse(await request.json().catch(() => null)) if (!result.success) return autoListingFailure('请提供有效的回调目标', 400) const backfill = await backfillXiaoyiDeliveriesForTarget(result.data.id, { limit: result.data.limit }) return autoListingResponse({ success: true, data: { targetId: result.data.id, ...backfill }, }) }) }