aboutsummaryrefslogtreecommitdiff
path: root/apps/web/src
diff options
context:
space:
mode:
authoryxshv <[email protected]>2024-04-13 12:37:15 +0530
committeryxshv <[email protected]>2024-04-13 12:37:15 +0530
commitcd71d6b4f99c09eb4608eb59026bf884c7cc6acf (patch)
tree2b97210b0dfa77d6346c32e9c086f9c583f20282 /apps/web/src
parentnew route /spaces (diff)
downloadsupermemory-cd71d6b4f99c09eb4608eb59026bf884c7cc6acf.tar.xz
supermemory-cd71d6b4f99c09eb4608eb59026bf884c7cc6acf.zip
fix dialog to add spaces
Diffstat (limited to 'apps/web/src')
-rw-r--r--apps/web/src/app/api/spaces/route.ts9
-rw-r--r--apps/web/src/app/page.tsx5
-rw-r--r--apps/web/src/server/db/test.ts10
3 files changed, 21 insertions, 3 deletions
diff --git a/apps/web/src/app/api/spaces/route.ts b/apps/web/src/app/api/spaces/route.ts
index 1e1aeba7..d6cc096b 100644
--- a/apps/web/src/app/api/spaces/route.ts
+++ b/apps/web/src/app/api/spaces/route.ts
@@ -3,6 +3,8 @@ import { sessions, space, users } from "@/server/db/schema";
import { eq } from "drizzle-orm";
import { NextRequest, NextResponse } from "next/server";
+export const runtime = "edge"
+
export async function GET(req: NextRequest) {
const token =
@@ -33,6 +35,7 @@ export async function GET(req: NextRequest) {
.from(sessions)
.where(eq(sessions.sessionToken, token!));
+
if (!sessionData || sessionData.length === 0) {
return new Response(
JSON.stringify({ message: "Invalid Key, session not found." }),
@@ -55,12 +58,14 @@ export async function GET(req: NextRequest) {
const user = userData[0]
-
const spaces = await db
.select()
.from(space)
.where(eq(space.user, user.id))
- .all()
+ .all();
+
+
+ console.log('data', spaces)
return NextResponse.json({
message: "OK",
diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx
index 419daa5a..1cbe6217 100644
--- a/apps/web/src/app/page.tsx
+++ b/apps/web/src/app/page.tsx
@@ -56,7 +56,10 @@ export default async function Home() {
const collectedSpaces = await db
.select()
.from(space)
- .where(and(eq(space.user, userData.id), not(eq(space.name, "none"))));
+ .where(eq(space.user, userData.id))
+ .all();
+
+ console.log(collectedSpaces)
// Fetch only first 3 content of each spaces
let contents: (typeof storedContent.$inferSelect)[] = [];
diff --git a/apps/web/src/server/db/test.ts b/apps/web/src/server/db/test.ts
new file mode 100644
index 00000000..9cb8f2b5
--- /dev/null
+++ b/apps/web/src/server/db/test.ts
@@ -0,0 +1,10 @@
+import { db } from "."
+import { space, user } from "./schema"
+
+const user = await db.select(user).all()
+
+await db.insert(space).values([
+ {
+
+ }
+])