diff options
| author | Kush Thaker <[email protected]> | 2024-07-31 11:37:54 +0530 |
|---|---|---|
| committer | Kush Thaker <[email protected]> | 2024-07-31 11:37:54 +0530 |
| commit | 241276be588312aec4f9e09a23c7951379238da8 (patch) | |
| tree | be8663cc96acb6e9cd2f62b071804d45ab05e238 /apps/web/app/api | |
| parent | queues so far (diff) | |
| download | archived-supermemory-241276be588312aec4f9e09a23c7951379238da8.tar.xz archived-supermemory-241276be588312aec4f9e09a23c7951379238da8.zip | |
db schema in packages
Diffstat (limited to 'apps/web/app/api')
| -rw-r--r-- | apps/web/app/api/chat/history/route.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/chat/route.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/ensureAuth.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/getCount/route.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/me/route.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/memories/route.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/spaces/route.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/store/friend/route.ts | 44 | ||||
| -rw-r--r-- | apps/web/app/api/store/helper.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/telegram/route.ts | 2 |
10 files changed, 9 insertions, 53 deletions
diff --git a/apps/web/app/api/chat/history/route.ts b/apps/web/app/api/chat/history/route.ts index 98b66064..197b8ee6 100644 --- a/apps/web/app/api/chat/history/route.ts +++ b/apps/web/app/api/chat/history/route.ts @@ -2,7 +2,7 @@ import { NextRequest } from "next/server"; import { ensureAuth } from "../../ensureAuth"; import { db } from "@/server/db"; import { eq } from "drizzle-orm"; -import { chatThreads } from "@/server/db/schema"; +import { chatThreads } from "@repo/db/schema"; export const runtime = "edge"; diff --git a/apps/web/app/api/chat/route.ts b/apps/web/app/api/chat/route.ts index a14c96df..78878e40 100644 --- a/apps/web/app/api/chat/route.ts +++ b/apps/web/app/api/chat/route.ts @@ -8,7 +8,7 @@ import { import { ensureAuth } from "../ensureAuth"; import { z } from "zod"; import { db } from "@/server/db"; -import { chatHistory as chatHistoryDb, chatThreads } from "@/server/db/schema"; +import { chatHistory as chatHistoryDb, chatThreads } from "@repo/db/schema"; import { and, eq, gt, sql } from "drizzle-orm"; import { join } from "path"; diff --git a/apps/web/app/api/ensureAuth.ts b/apps/web/app/api/ensureAuth.ts index 1fcd2914..92a5e3e8 100644 --- a/apps/web/app/api/ensureAuth.ts +++ b/apps/web/app/api/ensureAuth.ts @@ -1,6 +1,6 @@ import { NextRequest } from "next/server"; import { db } from "../../server/db"; -import { accounts, sessions, users } from "../../server/db/schema"; +import { accounts, sessions, users } from "@repo/db/schema"; import { eq } from "drizzle-orm"; export async function ensureAuth(req: NextRequest) { diff --git a/apps/web/app/api/getCount/route.ts b/apps/web/app/api/getCount/route.ts index f91b7b94..4fd77efd 100644 --- a/apps/web/app/api/getCount/route.ts +++ b/apps/web/app/api/getCount/route.ts @@ -1,6 +1,6 @@ import { db } from "@/server/db"; import { and, eq, ne, sql } from "drizzle-orm"; -import { sessions, storedContent, users } from "@/server/db/schema"; +import { sessions, storedContent, users } from "@repo/db/schema"; import { type NextRequest, NextResponse } from "next/server"; import { ensureAuth } from "../ensureAuth"; diff --git a/apps/web/app/api/me/route.ts b/apps/web/app/api/me/route.ts index ab408f3e..25aa27bc 100644 --- a/apps/web/app/api/me/route.ts +++ b/apps/web/app/api/me/route.ts @@ -1,6 +1,6 @@ import { db } from "@/server/db"; import { eq } from "drizzle-orm"; -import { sessions, users } from "@/server/db/schema"; +import { sessions, users } from "@repo/db/schema"; import { type NextRequest, NextResponse } from "next/server"; export const runtime = "edge"; diff --git a/apps/web/app/api/memories/route.ts b/apps/web/app/api/memories/route.ts index acb43b5d..0084524e 100644 --- a/apps/web/app/api/memories/route.ts +++ b/apps/web/app/api/memories/route.ts @@ -6,7 +6,7 @@ import { contentToSpace, storedContent, users, -} from "@/server/db/schema"; +} from "@repo/db/schema"; import { ensureAuth } from "../ensureAuth"; export const runtime = "edge"; diff --git a/apps/web/app/api/spaces/route.ts b/apps/web/app/api/spaces/route.ts index e85e07ed..27ff0dfb 100644 --- a/apps/web/app/api/spaces/route.ts +++ b/apps/web/app/api/spaces/route.ts @@ -1,5 +1,5 @@ import { db } from "@/server/db"; -import { space } from "@/server/db/schema"; +import { space } from "@repo/db/schema"; import { eq } from "drizzle-orm"; import { NextRequest, NextResponse } from "next/server"; import { ensureAuth } from "../ensureAuth"; diff --git a/apps/web/app/api/store/friend/route.ts b/apps/web/app/api/store/friend/route.ts deleted file mode 100644 index 554b1cee..00000000 --- a/apps/web/app/api/store/friend/route.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { type NextRequest } from "next/server"; -import { createMemoryFromAPI } from "../helper"; - -type FriendData = { - id: string; - created_at: string; - transcript: string; - structured: { - title: string; - overview: string; - action_items: [ - { - description: string; - }, - ]; - }; -}; - -export async function POST(req: NextRequest) { - const body: FriendData = await req.json(); - - const userId = new URL(req.url).searchParams.get("uid"); - - if (!userId) { - return new Response( - JSON.stringify({ status: 400, body: "Missing user ID" }), - ); - } - - await createMemoryFromAPI({ - data: { - title: "Friend: " + body.structured.title, - description: body.structured.overview, - pageContent: - body.transcript + "\n\n" + JSON.stringify(body.structured.action_items), - spaces: [], - type: "note", - url: "https://basedhardware.com", - }, - userId: userId, - }); - - return new Response(JSON.stringify({ status: 200, body: "success" })); -} diff --git a/apps/web/app/api/store/helper.ts b/apps/web/app/api/store/helper.ts index f8833970..2dc42125 100644 --- a/apps/web/app/api/store/helper.ts +++ b/apps/web/app/api/store/helper.ts @@ -1,6 +1,6 @@ import { z } from "zod"; import { db } from "@/server/db"; -import { contentToSpace, space, storedContent } from "@/server/db/schema"; +import { contentToSpace, space, storedContent } from "@repo/db/schema"; import { and, eq, inArray } from "drizzle-orm"; import { LIMITS } from "@/lib/constants"; import { limit } from "@/app/actions/doers"; diff --git a/apps/web/app/api/telegram/route.ts b/apps/web/app/api/telegram/route.ts index 78837e5f..dddfa2f4 100644 --- a/apps/web/app/api/telegram/route.ts +++ b/apps/web/app/api/telegram/route.ts @@ -1,5 +1,5 @@ import { db } from "@/server/db"; -import { storedContent, users } from "@/server/db/schema"; +import { storedContent, users } from "@repo/db/schema"; import { cipher } from "@/server/encrypt"; import { eq } from "drizzle-orm"; import { Bot, webhookCallback } from "grammy"; |