1
- import bcrypt from 'bcrypt' ;
2
- import postgres from ' postgres' ;
3
- import { invoices , customers , revenue , users } from ' ../lib/placeholder-data' ;
1
+ import bcrypt from "bcryptjs" ;
2
+ import postgres from " postgres" ;
3
+ import { invoices , customers , revenue , users } from " ../lib/placeholder-data" ;
4
4
5
- const sql = postgres ( process . env . POSTGRES_URL ! , { ssl : ' require' } ) ;
5
+ const sql = postgres ( process . env . POSTGRES_URL ! , { ssl : " require" } ) ;
6
6
7
7
async function seedUsers ( ) {
8
8
await sql `CREATE EXTENSION IF NOT EXISTS "uuid-ossp"` ;
@@ -23,7 +23,7 @@ async function seedUsers() {
23
23
VALUES (${ user . id } , ${ user . name } , ${ user . email } , ${ hashedPassword } )
24
24
ON CONFLICT (id) DO NOTHING;
25
25
` ;
26
- } ) ,
26
+ } )
27
27
) ;
28
28
29
29
return insertedUsers ;
@@ -48,8 +48,8 @@ async function seedInvoices() {
48
48
INSERT INTO invoices (customer_id, amount, status, date)
49
49
VALUES (${ invoice . customer_id } , ${ invoice . amount } , ${ invoice . status } , ${ invoice . date } )
50
50
ON CONFLICT (id) DO NOTHING;
51
- ` ,
52
- ) ,
51
+ `
52
+ )
53
53
) ;
54
54
55
55
return insertedInvoices ;
@@ -73,8 +73,8 @@ async function seedCustomers() {
73
73
INSERT INTO customers (id, name, email, image_url)
74
74
VALUES (${ customer . id } , ${ customer . name } , ${ customer . email } , ${ customer . image_url } )
75
75
ON CONFLICT (id) DO NOTHING;
76
- ` ,
77
- ) ,
76
+ `
77
+ )
78
78
) ;
79
79
80
80
return insertedCustomers ;
@@ -94,8 +94,8 @@ async function seedRevenue() {
94
94
INSERT INTO revenue (month, revenue)
95
95
VALUES (${ rev . month } , ${ rev . revenue } )
96
96
ON CONFLICT (month) DO NOTHING;
97
- ` ,
98
- ) ,
97
+ `
98
+ )
99
99
) ;
100
100
101
101
return insertedRevenue ;
@@ -110,7 +110,7 @@ export async function GET() {
110
110
seedRevenue ( ) ,
111
111
] ) ;
112
112
113
- return Response . json ( { message : ' Database seeded successfully' } ) ;
113
+ return Response . json ( { message : " Database seeded successfully" } ) ;
114
114
} catch ( error ) {
115
115
return Response . json ( { error } , { status : 500 } ) ;
116
116
}
0 commit comments