This commit is contained in:
echo committed 2025-05-06 10:01:03 +02:00
commit 0fa3c7ac48
140 files changed
+24289

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
try {
// Array of sources to create/update
const sourcesToUpsert = [
{
name: 'Vero',
url: 'https://pricelist.vero.com.mk/89_2.html',
logo: 'vero-logo.png',
},
{
name: 'dim',
url: 'https://dim.marketceni.mk/',
logo: 'tinex-logo.png',
},
// Add more sources as needed
];
// Upsert all sources
const upsertedSources = await Promise.all(
sourcesToUpsert.map((source) =>
prisma.source.upsert({
where: { name: source.name },
update: {
url: source.url,
logo: source.logo,
},
create: source,
}),
),
);
console.log('Upserted sources:', upsertedSources);
} catch (error) {
console.error('Error:', error);
} finally {
await prisma.$disconnect();
}
}
main();