From 2ddee1f1a78218b3aee286d23bc421df4a4d05ca Mon Sep 17 00:00:00 2001 From: RickyRAV <101335214+RickyRAV@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:51:08 +0100 Subject: [PATCH] this might acc work --- apps/dashboard/package.json | 1 + .../src/app/api/v1/quizzes/generate/route.ts | 1 + apps/dashboard/src/db/index.ts | 7 +-- package-lock.json | 57 +++++-------------- 4 files changed, 19 insertions(+), 47 deletions(-) diff --git a/apps/dashboard/package.json b/apps/dashboard/package.json index 133425b9..1478ab46 100644 --- a/apps/dashboard/package.json +++ b/apps/dashboard/package.json @@ -13,6 +13,7 @@ "@ai-sdk/openai": "^1.0.5", "@aws-sdk/client-translate": "^3.699.0", "@hookform/resolvers": "^3.9.0", + "@neondatabase/serverless": "^0.10.4", "@radix-ui/react-avatar": "^1.1.1", "@radix-ui/react-collapsible": "^1.1.1", "@radix-ui/react-dialog": "^1.1.2", diff --git a/apps/dashboard/src/app/api/v1/quizzes/generate/route.ts b/apps/dashboard/src/app/api/v1/quizzes/generate/route.ts index 3c103c6e..e141de07 100644 --- a/apps/dashboard/src/app/api/v1/quizzes/generate/route.ts +++ b/apps/dashboard/src/app/api/v1/quizzes/generate/route.ts @@ -13,6 +13,7 @@ import { generateQuiz } from "./services/quiz-generator.service"; import { createTranslateClient, translateQuiz } from "./utils/translator"; export const dynamic = "force-dynamic"; +export const runtime = "edge"; const ratelimit = new Ratelimit({ redis: Redis.fromEnv(), diff --git a/apps/dashboard/src/db/index.ts b/apps/dashboard/src/db/index.ts index af29bde8..684b358f 100644 --- a/apps/dashboard/src/db/index.ts +++ b/apps/dashboard/src/db/index.ts @@ -1,6 +1,3 @@ -import { drizzle } from "drizzle-orm/postgres-js"; -import postgres from "postgres"; +import { drizzle } from 'drizzle-orm/neon-serverless'; -// Disable prefetch as it is not supported for "Transaction" pool mode -export const client = postgres(process.env.DATABASE_URL!, { prepare: false }); -export const db = drizzle({ client }); +export const db = drizzle(process.env.DATABASE_URL!); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 8ac25ea3..592a4fcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "@ai-sdk/openai": "^1.0.5", "@aws-sdk/client-translate": "^3.699.0", "@hookform/resolvers": "^3.9.0", + "@neondatabase/serverless": "^0.10.4", "@radix-ui/react-avatar": "^1.1.1", "@radix-ui/react-collapsible": "^1.1.1", "@radix-ui/react-dialog": "^1.1.2", @@ -1640,8 +1641,6 @@ "resolved": "https://registry.npmjs.org/@neondatabase/serverless/-/serverless-0.10.4.tgz", "integrity": "sha512-2nZuh3VUO9voBauuh+IGYRhGU/MskWHt1IuZvHcJw6GLjDgtqj/KViKo7SIrLdGLdot7vFbiRRw+BgEy3wT9HA==", "license": "MIT", - "optional": true, - "peer": true, "dependencies": { "@types/pg": "8.11.6" } @@ -1712,6 +1711,17 @@ "node": ">=14" } }, + "node_modules/@planetscale/database": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/@planetscale/database/-/database-1.19.0.tgz", + "integrity": "sha512-Tv4jcFUFAFjOWrGSio49H6R2ijALv0ZzVBfJKIdm+kl9X046Fh4LLawrF9OMsglVbK6ukqMJsUCeucGAFTBcMA==", + "license": "Apache-2.0", + "optional": true, + "peer": true, + "engines": { + "node": ">=16" + } + }, "node_modules/@radix-ui/number": { "version": "1.1.0", "license": "MIT" @@ -3798,8 +3808,6 @@ "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.11.6.tgz", "integrity": "sha512-/2WmmBXHLsfRqzfHW7BNZ8SbYzE8OSk7i3WjFYvfgRHj7S1xj+16Je5fUKv3lVdVzk/zn9TXOqf+avFCFIE0yQ==", "license": "MIT", - "optional": true, - "peer": true, "dependencies": { "@types/node": "*", "pg-protocol": "*", @@ -6866,9 +6874,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", - "license": "MIT", - "optional": true, - "peer": true + "license": "MIT" }, "node_modules/on-change": { "version": "4.0.2", @@ -7175,8 +7181,6 @@ "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", "license": "ISC", - "optional": true, - "peer": true, "engines": { "node": ">=4.0.0" } @@ -7186,8 +7190,6 @@ "resolved": "https://registry.npmjs.org/pg-numeric/-/pg-numeric-1.0.2.tgz", "integrity": "sha512-BM/Thnrw5jm2kKLE5uJkXqqExRUY/toLHda65XgFTBTFYZyopbKjBe29Ii3RbkvlsMoFwD+tHeGaCjjv0gHlyw==", "license": "ISC", - "optional": true, - "peer": true, "engines": { "node": ">=4" } @@ -7207,17 +7209,13 @@ "version": "1.7.0", "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.7.0.tgz", "integrity": "sha512-hTK/mE36i8fDDhgDFjy6xNOG+LCorxLG3WO17tku+ij6sVHXh1jQUJ8hYAnRhNla4QVD2H8er/FOjc/+EgC6yQ==", - "license": "MIT", - "optional": true, - "peer": true + "license": "MIT" }, "node_modules/pg-types": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-4.0.2.tgz", "integrity": "sha512-cRL3JpS3lKMGsKaWndugWQoLOCoP+Cic8oseVcbr0qhPzYD5DWXK+RZ9LY9wxRf7RQia4SCwQlXk0q6FCPrVng==", "license": "MIT", - "optional": true, - "peer": true, "dependencies": { "pg-int8": "1.0.1", "pg-numeric": "1.0.2", @@ -7496,8 +7494,6 @@ "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-3.0.2.tgz", "integrity": "sha512-6faShkdFugNQCLwucjPcY5ARoW1SlbnrZjmGl0IrrqewpvxvhSLHimCVzqeuULCbG0fQv7Dtk1yDbG3xv7Veog==", "license": "MIT", - "optional": true, - "peer": true, "engines": { "node": ">=12" } @@ -7507,8 +7503,6 @@ "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-3.0.0.tgz", "integrity": "sha512-CNd4jim9RFPkObHSjVHlVrxoVQXz7quwNFpz7RY1okNNme49+sVyiTvTRobiLV548Hx/hb1BG+iE7h9493WzFw==", "license": "MIT", - "optional": true, - "peer": true, "dependencies": { "obuf": "~1.1.2" }, @@ -7521,8 +7515,6 @@ "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-2.1.0.tgz", "integrity": "sha512-K7Juri8gtgXVcDfZttFKVmhglp7epKb1K4pgrkLxehjqkrgPhfG6OO8LHLkfaqkbpjNRnra018XwAr1yQFWGcA==", "license": "MIT", - "optional": true, - "peer": true, "engines": { "node": ">=12" } @@ -7532,8 +7524,6 @@ "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-3.0.0.tgz", "integrity": "sha512-BSNDnbyZCXSxgA+1f5UU2GmwhoI0aU5yMxRGO8CdFEcY2BQF9xm/7MqKnYoM1nJDk8nONNWDk9WeSmePFhQdlw==", "license": "MIT", - "optional": true, - "peer": true, "engines": { "node": ">=12" } @@ -7542,9 +7532,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/postgres-range/-/postgres-range-1.1.4.tgz", "integrity": "sha512-i/hbxIE9803Alj/6ytL7UHQxRvZkI9O4Sy+J3HGc4F4oo/2eQAjTSNJ0bfxyse3bH0nuVesCk+3IRLaMtG3H6w==", - "license": "MIT", - "optional": true, - "peer": true + "license": "MIT" }, "node_modules/presentation": { "resolved": "apps/presentation", @@ -9431,21 +9419,6 @@ "@types/react-dom": "^18.2.19", "typescript": "^5.3.3" } - }, - "node_modules/react-email/node_modules/@next/swc-darwin-arm64": { - "version": "14.2.11", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.11.tgz", - "integrity": "sha512-eiY9u7wEJZWp/Pga07Qy3ZmNEfALmmSS1HtsJF3y1QEyaExu7boENz11fWqDmZ3uvcyAxCMhTrA1jfVxITQW8g==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } } } }