mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
added limit
This commit is contained in:
parent
0a2956436e
commit
d099d4bda9
1 changed files with 12 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue