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.

Update create-program.ts

Kiran K40ecc989f69f
diff --git a/apps/web/lib/actions/partners/create-program.ts b/apps/web/lib/actions/partners/create-program.ts
index 4365cf7e43..b12cf7d583 100644
--- a/apps/web/lib/actions/partners/create-program.ts
+++ b/apps/web/lib/actions/partners/create-program.ts
@@ -52,10 +52,17 @@ export const createProgram = async ({
await getDomainOrThrow({ workspace, domain });
+ const programId = createId({ prefix: "prog_" });
+
+ const logoUrl = uploadedLogo
+ ? await storage
+ .upload(`programs/${programId}/logo_${nanoid(7)}`, uploadedLogo)
+ .then(({ url }) => url)
+ : null;
+
// create a new program
const program = await prisma.$transaction(async (tx) => {
const folderId = createId({ prefix: "fold_" });
- const programId = createId({ prefix: "prog_" });
const defaultGroupId = createId({ prefix: "grp_" });
const programFolder = await tx.folder.upsert({
@@ -80,12 +87,6 @@ export const createProgram = async ({
},
});
- const logoUrl = uploadedLogo
- ? await storage
- .upload(`programs/${programId}/logo_${nanoid(7)}`, uploadedLogo)
- .then(({ url }) => url)
- : null;
-
const programData = await tx.program.create({
data: {
id: programId,