diff options
| author | Dhravya <[email protected]> | 2024-04-13 21:11:57 -0700 |
|---|---|---|
| committer | Dhravya <[email protected]> | 2024-04-13 21:11:57 -0700 |
| commit | 8752bcca28f9c331fbc4ef985472beea4381b481 (patch) | |
| tree | 0f4d0c140920a5350559fc81ed77580d80261db1 /apps/web/src | |
| parent | notes in vector db (diff) | |
| download | supermemory-8752bcca28f9c331fbc4ef985472beea4381b481.tar.xz supermemory-8752bcca28f9c331fbc4ef985472beea4381b481.zip | |
get pagecount as well
Diffstat (limited to 'apps/web/src')
| -rw-r--r-- | apps/web/src/app/api/getCount/route.ts | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/apps/web/src/app/api/getCount/route.ts b/apps/web/src/app/api/getCount/route.ts index 05a3aa30..3238e58a 100644 --- a/apps/web/src/app/api/getCount/route.ts +++ b/apps/web/src/app/api/getCount/route.ts @@ -46,7 +46,7 @@ export async function GET(req: NextRequest) { const session = { session: sessionData[0], user: user[0] }; - const count = await db + const tweetsCount = await db .select({ count: sql<number>`count(*)`.mapWith(Number), }) @@ -58,9 +58,23 @@ export async function GET(req: NextRequest) { ), ); + const pageCount = await db + .select({ + count: sql<number>`count(*)`.mapWith(Number), + }) + .from(storedContent) + .where( + and( + eq(storedContent.user, session.user.id), + eq(storedContent.type, "page"), + ), + ); + return NextResponse.json({ - tweetsCount: count[0].count, - limit: 1000, + tweetsCount: tweetsCount[0].count, + tweetsLimit: 1000, + pageCount: pageCount[0].count, + pageLimit: 100, user: session.user.email, }); } |