From a4bdfa809c49c5c0c86b668be9a2b354750bcb03 Mon Sep 17 00:00:00 2001 From: tsuvic <20010622+tsuvic@users.noreply.github.com> Date: Sun, 22 Jun 2025 16:53:58 +0900 Subject: [PATCH] Update route.ts --- dashboard/final-example/app/seed/route.ts | 16 ++++++++-------- dashboard/starter-example/app/seed/route.ts | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dashboard/final-example/app/seed/route.ts b/dashboard/final-example/app/seed/route.ts index c6428b27..22a78f4b 100644 --- a/dashboard/final-example/app/seed/route.ts +++ b/dashboard/final-example/app/seed/route.ts @@ -4,7 +4,7 @@ import { invoices, customers, revenue, users } from '../lib/placeholder-data'; const sql = postgres(process.env.POSTGRES_URL!, { ssl: 'require' }); -async function seedUsers() { +async function seedUsers(sql: postgres.TransactionSql) { await sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`; await sql` CREATE TABLE IF NOT EXISTS users ( @@ -29,7 +29,7 @@ async function seedUsers() { return insertedUsers; } -async function seedInvoices() { +async function seedInvoices(sql: postgres.TransactionSql) { await sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`; await sql` @@ -55,7 +55,7 @@ async function seedInvoices() { return insertedInvoices; } -async function seedCustomers() { +async function seedCustomers(sql: postgres.TransactionSql) { await sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`; await sql` @@ -80,7 +80,7 @@ async function seedCustomers() { return insertedCustomers; } -async function seedRevenue() { +async function seedRevenue(sql: postgres.TransactionSql) { await sql` CREATE TABLE IF NOT EXISTS revenue ( month VARCHAR(4) NOT NULL UNIQUE, @@ -104,10 +104,10 @@ async function seedRevenue() { export async function GET() { try { const result = await sql.begin((sql) => [ - seedUsers(), - seedCustomers(), - seedInvoices(), - seedRevenue(), + seedUsers(sql), + seedCustomers(sql), + seedInvoices(sql), + seedRevenue(sql), ]); return Response.json({ message: 'Database seeded successfully' }); diff --git a/dashboard/starter-example/app/seed/route.ts b/dashboard/starter-example/app/seed/route.ts index c6428b27..22a78f4b 100644 --- a/dashboard/starter-example/app/seed/route.ts +++ b/dashboard/starter-example/app/seed/route.ts @@ -4,7 +4,7 @@ import { invoices, customers, revenue, users } from '../lib/placeholder-data'; const sql = postgres(process.env.POSTGRES_URL!, { ssl: 'require' }); -async function seedUsers() { +async function seedUsers(sql: postgres.TransactionSql) { await sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`; await sql` CREATE TABLE IF NOT EXISTS users ( @@ -29,7 +29,7 @@ async function seedUsers() { return insertedUsers; } -async function seedInvoices() { +async function seedInvoices(sql: postgres.TransactionSql) { await sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`; await sql` @@ -55,7 +55,7 @@ async function seedInvoices() { return insertedInvoices; } -async function seedCustomers() { +async function seedCustomers(sql: postgres.TransactionSql) { await sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`; await sql` @@ -80,7 +80,7 @@ async function seedCustomers() { return insertedCustomers; } -async function seedRevenue() { +async function seedRevenue(sql: postgres.TransactionSql) { await sql` CREATE TABLE IF NOT EXISTS revenue ( month VARCHAR(4) NOT NULL UNIQUE, @@ -104,10 +104,10 @@ async function seedRevenue() { export async function GET() { try { const result = await sql.begin((sql) => [ - seedUsers(), - seedCustomers(), - seedInvoices(), - seedRevenue(), + seedUsers(sql), + seedCustomers(sql), + seedInvoices(sql), + seedRevenue(sql), ]); return Response.json({ message: 'Database seeded successfully' });