refactoring , dockerizing

This commit is contained in:
Schneider Roland
2025-01-08 17:12:09 +01:00
parent a8b144f554
commit 9d7bb39769
119 changed files with 433 additions and 159 deletions

View File

@@ -1,6 +1,8 @@
import bcrypt from 'bcrypt';
import { invoices, customers, revenue, users } from './placeholder-data';
import strapiApi from "@/app/api/strapi/strapi-api";
// const client = await connectionPool.connect();
import connectionPool from "../../db/db";
@@ -108,16 +110,23 @@ export async function GET() {
// 'Uncomment this file and remove this line. You can delete this file when you are finished.',
// });
try {
console.info("get request")
strapiApi.getHomePage();
console.info("begin")
await connectionPool.query(`BEGIN`);
await seedUsers();
await seedCustomers();
// await seedInvoices();
// await seedRevenue();
await seedInvoices();
await seedRevenue();
await connectionPool.query(`COMMIT`);
console.info('Database seeded successfully')
return Response.json({ message: 'Database seeded successfully' });
} catch (error) {
await connectionPool.query(`ROLLBACK`);
console.info("error in seed")
return Response.json({ error }, { status: 500 });
}
}