```await products.data.map(async (product) => {...
# orm-help
t
Copy code
await products.data.map(async (product) => {
    const productData = {
      id: product.id,
      active: product.active,
      name: product.name,
      description: product.description,
      image: product.images?.[0] ?? null,
      metadata: product.metadata,
    }
    await db.product.upsert({
      where: { id: productData.id },
      update: productData,
      create: productData,
    })
    console.log(`Product inserted/updated: ${product.id}`)
  })