The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
address coderabbit feedback
Steven Teyf8756916ce71
diff --git a/apps/web/lib/api/partners/create-and-enroll-partner.ts b/apps/web/lib/api/partners/create-and-enroll-partner.tsindex ccc57b983c..45d76c4505 100644--- a/apps/web/lib/api/partners/create-and-enroll-partner.ts+++ b/apps/web/lib/api/partners/create-and-enroll-partner.ts@@ -82,9 +82,19 @@ export const createAndEnrollPartner = async ({}}+ const finalGroupId = groupId || program.defaultGroupId;+ // this should never happen, but just in case+ if (!finalGroupId) {+ throw new DubApiError({+ message:+ "There was no group ID provided, and the program does not have a default group. Please contact support.",+ code: "bad_request",+ });+ }+const group = await getGroupOrThrow({programId: program.id,- groupId: groupId || program.defaultGroupId!,+ groupId: finalGroupId,includeRewardsAndDiscount: true,});diff --git a/apps/web/lib/rewardful/import-campaign.ts b/apps/web/lib/rewardful/import-campaign.tsindex 7ec1d72662..b929c33ef1 100644--- a/apps/web/lib/rewardful/import-campaign.ts+++ b/apps/web/lib/rewardful/import-campaign.ts@@ -70,7 +70,7 @@ export async function importCampaign(payload: RewardfulImportPayload) {});// if the default group has an associated sale reward already, we need to create a new group- if (groups[0].saleRewardId) {+ if (groups.length > 0 && groups[0].saleRewardId) {const groupSlug = `rewardful-${campaignId}`;const createdGroup = await prisma.partnerGroup.upsert({where: {