Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

add BountyApproved to EMAIL_TEMPLATES_MAP

Steven Tey0ed77b8847f0
diff --git a/apps/web/lib/email/email-templates-map.ts b/apps/web/lib/email/email-templates-map.ts
index 0bf906c483..47f0128f2d 100644
--- a/apps/web/lib/email/email-templates-map.ts
+++ b/apps/web/lib/email/email-templates-map.ts
@@ -1,9 +1,11 @@
+import BountyApproved from "@dub/email/templates/bounty-approved";
import PartnerBanned from "@dub/email/templates/partner-banned";
import PartnerDeactivated from "@dub/email/templates/partner-deactivated";
import PartnerPayoutConfirmed from "@dub/email/templates/partner-payout-confirmed";
import PartnerPayoutProcessed from "@dub/email/templates/partner-payout-processed";
export const EMAIL_TEMPLATES_MAP = {
+ BountyApproved,
PartnerPayoutConfirmed,
PartnerPayoutProcessed,
PartnerDeactivated,
diff --git a/apps/web/scripts/perplexity/review-bounties.ts b/apps/web/scripts/perplexity/review-bounties.ts
index ca7d432655..95314c57cd 100644
--- a/apps/web/scripts/perplexity/review-bounties.ts
+++ b/apps/web/scripts/perplexity/review-bounties.ts
@@ -1,8 +1,10 @@
import { createId } from "@/lib/api/create-id";
+import BountyApproved from "@dub/email/templates/bounty-approved";
import { prisma } from "@dub/prisma";
import { Prisma } from "@dub/prisma/client";
import "dotenv-flow/config";
import { syncTotalCommissions } from "../../lib/api/partners/sync-total-commissions";
+import { queueBatchEmail } from "../../lib/email/queue-batch-email";
const userId = "xxx";
@@ -19,7 +21,11 @@ async function main() {
bountyId: bounty.id,
status: "submitted",
},
- take: 1000,
+ take: 500,
+ include: {
+ partner: true,
+ program: true,
+ },
});
const validSubmissions = bountySubmissions.filter((submission) => {
@@ -90,6 +96,29 @@ async function main() {
`Updated submission ${submission.id} to have commission ${commission.id} + synced total commissions`,
);
}
+ const qstashRes = await queueBatchEmail<typeof BountyApproved>(
+ validSubmissions
+ .filter((s) => s.partner.email)
+ .map((s) => ({
+ subject: "Bounty approved!",
+ to: s.partner.email!,
+ variant: "notifications",
+ replyTo: s.program.supportEmail || "noreply",
+ templateName: "BountyApproved",
+ templateProps: {
+ email: s.partner.email!,
+ program: {
+ name: s.program.name,
+ slug: s.program.slug,
+ },
+ bounty: {
+ name: bounty.name,
+ type: bounty.type,
+ },
+ },
+ })),
+ );
+ console.log("qstashRes", qstashRes);
}
main();