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.

Sync the index when an admin changes a partner's country

Rafid915fbf174bb
diff --git a/apps/web/app/(ee)/api/admin/partners/[partnerId]/route.ts b/apps/web/app/(ee)/api/admin/partners/[partnerId]/route.ts
index 55b158e69c..c41853b0fe 100644
--- a/apps/web/app/(ee)/api/admin/partners/[partnerId]/route.ts
+++ b/apps/web/app/(ee)/api/admin/partners/[partnerId]/route.ts
@@ -1,3 +1,4 @@
+import { queuePartnerSearchSync } from "@/lib/api/partners/queue-partner-search-sync";
import { withAdmin } from "@/lib/auth";
import { qstash } from "@/lib/cron";
import { prisma } from "@/lib/prisma";
@@ -159,6 +160,10 @@ export const PATCH = withAdmin(async ({ params, req }) => {
},
});
+ // Country is a filterable field on the document, so an admin correcting it
+ // has to reach the index or the partner stays findable under the old one.
+ waitUntil(queuePartnerSearchSync({ partnerIds: [partner.id] }));
+
// if there was an existing veriff session, trigger a country change verification
if (partner.identityVerifiedAt) {
waitUntil(