feat: add the view graph on tiktok

This commit is contained in:
Pierre Ryssen
2026-03-27 00:58:38 +01:00
parent 51a376400c
commit 9bdbe8e153
6 changed files with 138 additions and 14 deletions

View File

@@ -77,6 +77,7 @@ export async function GET(req: NextRequest) {
followers: true,
likes: true,
videoCount: true,
views: true,
},
});
@@ -88,7 +89,7 @@ export async function POST(req: NextRequest) {
if (!userId) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
const body = await req.json();
const { followers, likes, videoCount, displayName, openId } = body;
const { followers, likes, videoCount, views, displayName, openId } = body;
if (followers === undefined) {
return NextResponse.json({ error: "Champ 'followers' requis" }, { status: 400 });
@@ -115,7 +116,7 @@ export async function POST(req: NextRequest) {
followers: followers ?? 0,
likes: likes ?? 0,
videoCount: videoCount ?? 0,
views: 0,
views: views ?? 0,
},
});