aboutsummaryrefslogtreecommitdiff
path: root/apps/web/src
diff options
context:
space:
mode:
authorDhravya <[email protected]>2024-04-14 13:59:32 -0700
committerDhravya <[email protected]>2024-04-14 13:59:32 -0700
commitd099d4bda9ecaa823a0874281734d3e0142ff78c (patch)
tree1c141f3ed8f2418748713a180c4e65d3fe275d75 /apps/web/src
parenteverything done (diff)
downloadsupermemory-d099d4bda9ecaa823a0874281734d3e0142ff78c.tar.xz
supermemory-d099d4bda9ecaa823a0874281734d3e0142ff78c.zip
added limit
Diffstat (limited to 'apps/web/src')
-rw-r--r--apps/web/src/app/api/store/route.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/web/src/app/api/store/route.ts b/apps/web/src/app/api/store/route.ts
index 7fa92b16..f9c1ea40 100644
--- a/apps/web/src/app/api/store/route.ts
+++ b/apps/web/src/app/api/store/route.ts
@@ -82,9 +82,19 @@ export async function POST(req: NextRequest) {
count: sql<number>`count(*)`.mapWith(Number),
})
.from(storedContent)
- .where(eq(storedContent.user, session.user.id));
+ .where(
+ and(
+ eq(storedContent.user, session.user.id),
+ eq(storedContent.type, "page"),
+ ),
+ );
- console.log("count", count[0].count);
+ if (count[0].count > 100) {
+ return NextResponse.json(
+ { message: "Error", error: "Limit exceeded" },
+ { status: 499 },
+ );
+ }
const { id } = (
await db