The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
double filters
Steven Teydd4fff3a2658
diff --git a/apps/web/app/api/cron/year-in-review/route.ts b/apps/web/app/api/cron/year-in-review/route.tsindex 8a64bd9e24..66aa813144 100644--- a/apps/web/app/api/cron/year-in-review/route.ts+++ b/apps/web/app/api/cron/year-in-review/route.ts@@ -57,43 +57,45 @@ export async function POST(req: Request) {return new Response("No jobs found. Skipping...");}- const emailData = yearInReviews.flatMap(- ({ workspace, totalClicks, totalLinks, topCountries, topLinks }) =>- workspace.users- .map(({ user }) => {- if (!user.email) {- return null;- }-- return {- workspaceId: workspace.id,- email: {- from: "Steven from Dub.co <[email protected]>",- to: user.email,- reply_to: "[email protected]",- subject: "Dub Year in Review π",- text: "Thank you for your support and here's to another year of your activity on Dub! Here's a look back at your activity in 2024.",- react: DubWrapped({- email: user.email,- workspace: {- logo: workspace.logo,- name: workspace.name,- slug: workspace.slug,- },- stats: {- "Total Links": totalLinks,- "Total Clicks": totalClicks,- },- // @ts-ignore- topLinks,- // @ts-ignore- topCountries,- }),- },- };- })- .filter((data) => data !== null),- );+ const emailData = yearInReviews+ .flatMap(+ ({ workspace, totalClicks, totalLinks, topCountries, topLinks }) =>+ workspace.users+ .map(({ user }) => {+ if (!user.email) {+ return null;+ }++ return {+ workspaceId: workspace.id,+ email: {+ from: "Steven from Dub.co <[email protected]>",+ to: user.email,+ reply_to: "[email protected]",+ subject: "Dub Year in Review π",+ text: "Thank you for your support and here's to another year of your activity on Dub! Here's a look back at your activity in 2024.",+ react: DubWrapped({+ email: user.email,+ workspace: {+ logo: workspace.logo,+ name: workspace.name,+ slug: workspace.slug,+ },+ stats: {+ "Total Links": totalLinks,+ "Total Clicks": totalClicks,+ },+ // @ts-ignore+ topLinks,+ // @ts-ignore+ topCountries,+ }),+ },+ };+ })+ .filter((data) => data !== null),+ )+ .filter((data) => data !== null);if (emailData.length === 0) {return new Response("No email data found. Skipping...");