feat: implement home page, business directory, and administrative management features with updated schema and API routes
Some checks failed
Build and Push App / build (push) Failing after 51s

This commit is contained in:
2026-04-23 14:40:50 +02:00
parent 88e4c13b9f
commit e6310f30de
23 changed files with 1124 additions and 222 deletions

15
scratch/check-cats.ts Normal file
View File

@@ -0,0 +1,15 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function check() {
try {
const count = await prisma.businessCategory.count();
console.log('Category count:', count);
const cats = await prisma.businessCategory.findMany({take: 5});
console.log('Sample:', cats);
} catch (e: any) {
console.error('Error:', e.message);
} finally {
await prisma.$disconnect();
}
}
check();

View File

@@ -0,0 +1,38 @@
import { PrismaClient } from '@prisma/client';
import { PrismaPg } from '@prisma/adapter-pg';
import pg from 'pg';
import { config } from 'dotenv';
config();
config({ path: '.env.local', override: true });
const connectionString = process.env.DATABASE_URL!;
const pool = new pg.Pool({ connectionString });
const adapter = new PrismaPg(pool);
const prisma = new PrismaClient({ adapter });
async function migrate() {
console.log('Starting migration...');
const categories = await prisma.businessCategory.findMany();
const categoryMap = new Map(categories.map(c => [c.name, c.id]));
const businesses = await prisma.business.findMany();
let updatedCount = 0;
for (const biz of businesses) {
const catId = categoryMap.get(biz.category);
if (catId) {
await prisma.business.update({
where: { id: biz.id },
data: { categoryId: catId }
});
updatedCount++;
}
}
console.log(`Migration finished. Updated ${updatedCount} businesses.`);
}
migrate()
.catch(console.error)
.finally(() => prisma.$disconnect());