66c2bbec8b
- Dashboard with campaign management, asset gallery, and publishing queue - 7-agent pipeline: trend scout, research, scripts, ad creative, video, copy, distribution - Campaign form with screenshot upload, goal picker, platform selection - Campaign detail view with Details/Pipeline/Assets/Chat tabs - Two-set image generation: Gemini AI (NanoBanana MCP) + Canvas Design posters - Remotion video rendering with phone.png frame and real screenshot alignment - honeyDue branding: blue #0079FF, orange #FF9400, Inter font, warm off-white - Asset cards with source badges (Gemini/Canvas/Remotion/Playwright) - Markdown/JSON render endpoint for viewing pipeline outputs as HTML - Settings page with Tavily, Gemini, Postiz, Nextdoor integration management - Claude Chat for campaign feedback loop with streaming SSE - Postiz publishing modal with scheduling - Auth with NextAuth credentials + JWT sessions - SQLite via Prisma with better-sqlite3 adapter Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import { auth } from "@/lib/auth";
|
|
import { prisma } from "@/lib/prisma";
|
|
|
|
export async function GET() {
|
|
const session = await auth();
|
|
if (!session) return new Response("Unauthorized", { status: 401 });
|
|
|
|
const oneWeekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
|
|
|
|
const [
|
|
activeCampaigns,
|
|
pendingReview,
|
|
publishedThisWeek,
|
|
recentCampaigns,
|
|
trendReports,
|
|
] = await Promise.all([
|
|
prisma.campaign.count({
|
|
where: { status: { in: ["running", "review"] } },
|
|
}),
|
|
prisma.asset.count({
|
|
where: {
|
|
status: "draft",
|
|
campaign: { status: { in: ["review", "running"] } },
|
|
},
|
|
}),
|
|
prisma.asset.count({
|
|
where: {
|
|
status: "published",
|
|
createdAt: { gte: oneWeekAgo },
|
|
},
|
|
}),
|
|
prisma.campaign.findMany({
|
|
take: 5,
|
|
orderBy: { createdAt: "desc" },
|
|
select: { id: true, name: true, status: true, createdAt: true },
|
|
}),
|
|
prisma.trendReport.findMany({
|
|
orderBy: { createdAt: "desc" },
|
|
take: 10,
|
|
}),
|
|
]);
|
|
|
|
return Response.json({
|
|
activeCampaigns,
|
|
pendingReview,
|
|
publishedThisWeek,
|
|
recentCampaigns,
|
|
trendReports,
|
|
});
|
|
}
|