diff options
| author | Dhravya <[email protected]> | 2024-04-14 13:59:32 -0700 |
|---|---|---|
| committer | Dhravya <[email protected]> | 2024-04-14 13:59:32 -0700 |
| commit | d099d4bda9ecaa823a0874281734d3e0142ff78c (patch) | |
| tree | 1c141f3ed8f2418748713a180c4e65d3fe275d75 /apps/web/src/app/api | |
| parent | everything done (diff) | |
| download | supermemory-d099d4bda9ecaa823a0874281734d3e0142ff78c.tar.xz supermemory-d099d4bda9ecaa823a0874281734d3e0142ff78c.zip | |
added limit
Diffstat (limited to 'apps/web/src/app/api')
| -rw-r--r-- | apps/web/src/app/api/store/route.ts | 14 |
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 |