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.

skipProgramChecks

Steven Teyc17d70a8038f
diff --git a/apps/web/app/api/partners/links/route.ts b/apps/web/app/api/partners/links/route.ts
index 30982c8117..4be4eadb42 100644
--- a/apps/web/app/api/partners/links/route.ts
+++ b/apps/web/app/api/partners/links/route.ts
@@ -70,6 +70,7 @@ export const POST = withWorkspace(
},
workspace,
userId: session.user.id,
+ skipProgramChecks: true, // skip this cause we've already validated the program above
});
if (error != null) {
diff --git a/apps/web/lib/api/links/process-link.ts b/apps/web/lib/api/links/process-link.ts
index 293fbc6a4b..412d086326 100644
--- a/apps/web/lib/api/links/process-link.ts
+++ b/apps/web/lib/api/links/process-link.ts
@@ -28,6 +28,7 @@ export async function processLink<T extends Record<string, any>>({
bulk = false,
skipKeyChecks = false, // only skip when key doesn't change (e.g. when editing a link)
skipExternalIdChecks = false, // only skip when externalId doesn't change (e.g. when editing a link)
+ skipProgramChecks = false,
}: {
payload: NewLinkProps & T;
workspace?: Pick<WorkspaceProps, "id" | "plan" | "flags">;
@@ -35,6 +36,7 @@ export async function processLink<T extends Record<string, any>>({
bulk?: boolean;
skipKeyChecks?: boolean;
skipExternalIdChecks?: boolean;
+ skipProgramChecks?: boolean;
}): Promise<
| {
link: NewLinkProps & T;
@@ -370,7 +372,7 @@ export async function processLink<T extends Record<string, any>>({
}
// Program validity checks
- if (programId) {
+ if (programId && !skipProgramChecks) {
const program = await prisma.program.findUnique({
where: { id: programId },
select: {