Files
ClaudeMarketing/app/api/assets/route.ts
T
Trey t 807dfc539b feat: add asset preferences, video research, and Remotion ad assets
- Add thumbs-down feedback modal and preference API endpoint
- Add AI UGC video platforms research doc
- Add ReflectAd Remotion composition with public flow assets
- Add gemini-ad-designer and poster-ad-designer pipeline skills
- Add research_reflect_v1.1 pipeline script

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 20:28:07 -05:00

50 lines
1.4 KiB
TypeScript

import { auth } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
import { getActiveAppId } from "@/lib/active-app";
export async function GET(request: Request) {
const session = await auth();
if (!session) return new Response("Unauthorized", { status: 401 });
const { searchParams } = new URL(request.url);
const campaignId = searchParams.get("campaignId");
const type = searchParams.get("type");
const platform = searchParams.get("platform");
const status = searchParams.get("status");
const search = searchParams.get("search");
const appId = await getActiveAppId();
const where: Record<string, unknown> = {};
if (campaignId) where.campaignId = campaignId;
if (type === "media") {
where.type = { in: ["image", "video"] };
} else if (type && type !== "all") {
where.type = type;
}
if (platform && platform !== "all") where.platform = platform;
if (status && status !== "all") where.status = status;
if (search) {
where.OR = [
{ fileName: { contains: search } },
{ metadata: { contains: search } },
];
}
// Filter by active app's campaigns
if (appId) {
where.campaign = { ...((where.campaign as object) || {}), appId };
}
const assets = await prisma.asset.findMany({
where,
orderBy: { createdAt: "desc" },
include: {
campaign: { select: { name: true } },
parentAsset: { select: { id: true, fileName: true } },
},
});
return Response.json(assets);
}