Files
bikeApp/prisma/seed.ts
T
fegger b307919bf7 Refactor bike builder into Next.js app
Replace the single JSX file with a Next.js project, shared catalog and recommendation modules, backend API routes, file-backed persistence, Ollama recommendation endpoint, and picture-layer bike composition. Add initial aligned component assets for existing BSU layers plus RockShox and Maxxis products.
2026-05-19 12:56:41 +02:00

25 lines
985 B
TypeScript

import { PrismaClient } from "@prisma/client";
import { frames, forks, shocks, tires } from "../src/lib/catalog";
const prisma = new PrismaClient();
async function main() {
const products = [...frames, ...forks, ...shocks, ...tires];
for (const product of products) {
const { id, category, brand, model, imagePath, sources } = product;
const position = "position" in product ? product.position : null;
await prisma.product.upsert({
where: { id },
update: { category, position, brand, model, imagePath, specs: JSON.stringify(product), setup: JSON.stringify(product), sources: JSON.stringify(sources) },
create: { id, category, position, brand, model, imagePath, specs: JSON.stringify(product), setup: JSON.stringify(product), sources: JSON.stringify(sources) },
});
}
await prisma.riderPreference.upsert({
where: { id: "default" },
update: {},
create: { id: "default" },
});
}
main().finally(async () => prisma.$disconnect());