This commit is contained in:
Your Name committed 2026-10-18 13:55:18 +07:00
1 parent 4fcdd8a816
commit f49776f9cb
14 files changed
+4012 -21

No files matched your search

+27
View File
@@ -469,6 +469,33 @@ export const toolsRoute = new Elysia({ prefix: "/tools" })
}
)
// ── 4.1 POST Bulk Link / Unlink Master Variants ──────────────────────────────
.post(
"/marketplace-products/bulk-map",
async ({ body }: { body: { mappings: Array<{ marketplaceProductId: number; masterVariantId: number | null }> } }) => {
const { mappings } = body;
await prisma.$transaction(
mappings.map((m) =>
prisma.marketplaceProduct.update({
where: { id: m.marketplaceProductId },
data: { masterVariantId: m.masterVariantId },
})
)
);
return { success: true, count: mappings.length };
},
{
body: t.Object({
mappings: t.Array(
t.Object({
marketplaceProductId: t.Number(),
masterVariantId: t.Nullable(t.Number()),
})
),
}),
}
)
// ── 5. POST Bulk Auto Match Unmapped Items ──────────────────────────────────
.post("/marketplace-products/bulk-auto-match", async () => {
const masterVariants = await prisma.productVariant.findMany({