refactoring , dockerizing
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user