status añadido, cambios en el responsive al ver el producto
This commit is contained in:
@@ -7,19 +7,31 @@ export async function seedProducts(db: NodePgDatabase<typeof schema>) {
|
||||
console.log('Seeding example product...');
|
||||
|
||||
// Insert inventory
|
||||
const array = [{title:'manzana',description:'fruta roja',price:'100',urlImg:'apple.avif',address:"Calle 1",userId:1,stock:0}];
|
||||
const array = [
|
||||
{
|
||||
title:'manzana',
|
||||
description:'Fruta pequeña y roja, extraída de los árboles de nuestra fundación, de increíble sabor',
|
||||
price:'100',
|
||||
stock:10,
|
||||
address:"Calle 1",
|
||||
status:'PUBLICADO', // PUBLICADO, AGOTADO, BORRADOR
|
||||
urlImg:'apple.avif',
|
||||
userId:1
|
||||
}
|
||||
];
|
||||
|
||||
for (const item of array) {
|
||||
try {
|
||||
await db.insert(products).values({
|
||||
title: item.title,
|
||||
description: item.description,
|
||||
price: item.price,
|
||||
stock: item.stock,
|
||||
address: item.address,
|
||||
urlImg: item.urlImg,
|
||||
userId: item.userId
|
||||
}).onConflictDoNothing();
|
||||
// await db.insert(products).values({
|
||||
// title: item.title,
|
||||
// description: item.description,
|
||||
// price: item.price,
|
||||
// stock: item.stock,
|
||||
// address: item.address,
|
||||
// urlImg: item.urlImg,
|
||||
// userId: item.userId
|
||||
// }).onConflictDoNothing();
|
||||
await db.insert(products).values(item).onConflictDoNothing();
|
||||
} catch (error) {
|
||||
console.error(`Error creating products '${item.title}':`, error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user