cut early if no video

This commit is contained in:
Omer Sabic 2024-06-13 22:28:33 +02:00
parent b66e27d49b
commit 9ad2437a79

View File

@ -51,6 +51,7 @@ export const webhookRoutes = (fastify, _, done) => {
const feed = body["feed"]; const feed = body["feed"];
// Example processing: log the video IDs of new videos // Example processing: log the video IDs of new videos
const entry = feed.entry[0]; const entry = feed.entry[0];
if(!entry) return reply.code(200).send();
const [{users: user, sites: site}] = await db.select().from(users).leftJoin(sites, eq(users.id, sites.user_id)).where(eq(users.channel_id, "UC" + feed["yt:channelId"][0])); const [{users: user, sites: site}] = await db.select().from(users).leftJoin(sites, eq(users.id, sites.user_id)).where(eq(users.channel_id, "UC" + feed["yt:channelId"][0]));
if (!user || !site) throw new Error("User not found"); if (!user || !site) throw new Error("User not found");