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.

quick follow-up changes

Steven Teya6cf4e2fd32c
diff --git a/apps/web/app/(ee)/api/cron/trigger-withdrawal/route.ts b/apps/web/app/(ee)/api/cron/trigger-withdrawal/route.ts
index 3352091db4..208380db14 100644
--- a/apps/web/app/(ee)/api/cron/trigger-withdrawal/route.ts
+++ b/apps/web/app/(ee)/api/cron/trigger-withdrawal/route.ts
@@ -2,7 +2,8 @@ import { handleAndReturnErrorResponse } from "@/lib/api/errors";
import { verifyVercelSignature } from "@/lib/cron/verify-vercel";
import { stripe } from "@/lib/stripe";
import { prisma } from "@dub/prisma";
-import { NextResponse } from "next/server";
+import { currencyFormatter } from "@dub/utils";
+import { logAndRespond } from "../utils";
export const dynamic = "force-dynamic";
@@ -61,9 +62,9 @@ export async function GET(req: Request) {
const balanceToWithdraw = currentNetBalance - reservedBalance;
if (balanceToWithdraw <= 10000) {
- return NextResponse.json({
- message: "Balance to withdraw is less than $100, skipping...",
- });
+ return logAndRespond(
+ "Balance to withdraw is less than $100, skipping...",
+ );
}
const createdPayout = await stripe.payouts.create({
@@ -71,14 +72,9 @@ export async function GET(req: Request) {
currency: "usd",
});
- return NextResponse.json({
- currentAvailableBalance,
- currentPendingBalance,
- currentNetBalance,
- reservedBalance,
- balanceToWithdraw,
- createdPayout,
- });
+ return logAndRespond(
+ `Created payout: ${createdPayout.id} (${currencyFormatter(createdPayout.amount / 100, { currency: createdPayout.currency })})`,
+ );
} catch (error) {
return handleAndReturnErrorResponse(error);
}
diff --git a/apps/web/app/(ee)/api/messages/route.ts b/apps/web/app/(ee)/api/messages/route.ts
index b671559304..2dca84ce3f 100644
--- a/apps/web/app/(ee)/api/messages/route.ts
+++ b/apps/web/app/(ee)/api/messages/route.ts
@@ -36,6 +36,7 @@ export const GET = withWorkspace(
},
}),
},
+ take: 1000, // TODO: add pagination later
include: {
partner: {
include: {
diff --git a/apps/web/scripts/migrations/backfill-campaign-message-to-markdown.ts b/apps/web/scripts/migrations/migrate-campaign-message-to-markdown.ts
similarity index 83%
rename from apps/web/scripts/migrations/backfill-campaign-message-to-markdown.ts
rename to apps/web/scripts/migrations/migrate-campaign-message-to-markdown.ts
index 12606279ad..2044c81f58 100644
--- a/apps/web/scripts/migrations/backfill-campaign-message-to-markdown.ts
+++ b/apps/web/scripts/migrations/migrate-campaign-message-to-markdown.ts
@@ -15,7 +15,7 @@ async function main() {
id: true,
text: true,
},
- take: 10,
+ take: 100,
...(cursor && {
skip: 1,
cursor: {
@@ -31,18 +31,12 @@ async function main() {
break;
}
- await prisma.$transaction(
- messages.map((message) =>
- prisma.message.update({
- where: {
- id: message.id,
- },
- data: {
- text: convertToMarkdown(message.text),
- },
- }),
- ),
- );
+ for (const message of messages) {
+ await prisma.message.update({
+ where: { id: message.id },
+ data: { text: convertToMarkdown(message.text) },
+ });
+ }
batchNumber++;
processedCount += messages.length;
diff --git a/packages/ui/src/icons/nucleo/envelope-ban.tsx b/packages/ui/src/icons/nucleo/envelope-ban.tsx
index 5f2e2d34d0..7cae7a4c69 100644
--- a/packages/ui/src/icons/nucleo/envelope-ban.tsx
+++ b/packages/ui/src/icons/nucleo/envelope-ban.tsx
@@ -10,34 +10,34 @@ export function EnvelopeBan(props: SVGProps<SVGSVGElement>) {
xmlns="http://www.w3.org/2000/svg"
{...props}
>
- <g clip-path="url(#clip0_31261_84159)">
+ <g clipPath="url(#clip0_31261_84159)">
<path
d="M1.36133 4.47217L6.62455 7.37561C6.85866 7.50472 7.14177 7.50472 7.37588 7.37561L12.6391 4.47217"
stroke="#737373"
- stroke-width="1.5"
- stroke-linecap="round"
- stroke-linejoin="round"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
/>
<path
d="M12.6391 6.35442V4.08339C12.6391 3.22394 11.943 2.52783 11.0836 2.52783H2.91688C2.05744 2.52783 1.36133 3.22394 1.36133 4.08339V9.91672C1.36133 10.7762 2.05744 11.4723 2.91688 11.4723H6.0637"
stroke="#737373"
- stroke-width="1.5"
- stroke-linecap="round"
- stroke-linejoin="round"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
/>
<path
d="M10.8891 13.4166C12.2852 13.4166 13.4169 12.285 13.4169 10.8889C13.4169 9.49275 12.2852 8.36108 10.8891 8.36108C9.49299 8.36108 8.36133 9.49275 8.36133 10.8889C8.36133 12.285 9.49299 13.4166 10.8891 13.4166Z"
stroke="#737373"
- stroke-width="1.5"
- stroke-linecap="round"
- stroke-linejoin="round"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
/>
<path
d="M9.10156 12.6762L12.6716 9.1062"
stroke="#737373"
- stroke-width="1.5"
- stroke-linecap="round"
- stroke-linejoin="round"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
/>
</g>
<defs>
diff --git a/packages/ui/src/icons/nucleo/envelope-check.tsx b/packages/ui/src/icons/nucleo/envelope-check.tsx
index 0383fee792..5b9afe07c9 100644
--- a/packages/ui/src/icons/nucleo/envelope-check.tsx
+++ b/packages/ui/src/icons/nucleo/envelope-check.tsx
@@ -10,20 +10,20 @@ export function EnvelopeCheck(props: SVGProps<SVGSVGElement>) {
xmlns="http://www.w3.org/2000/svg"
{...props}
>
- <g clip-path="url(#clip0_31261_84148)">
+ <g clipPath="url(#clip0_31261_84148)">
<path
d="M1.36133 4.47217L6.62455 7.37561C6.85866 7.50472 7.14177 7.50472 7.37588 7.37561L12.6391 4.47217"
stroke="#737373"
- stroke-width="1.5"
- stroke-linecap="round"
- stroke-linejoin="round"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
/>
<path
d="M12.6391 6.35372V4.08339C12.6391 3.22472 11.943 2.52783 11.0836 2.52783H2.91688C2.05744 2.52783 1.36133 3.22472 1.36133 4.08339V9.91672C1.36133 10.7754 2.05744 11.4723 2.91688 11.4723H6.063"
stroke="#737373"
- stroke-width="1.5"
- stroke-linecap="round"
- stroke-linejoin="round"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
/>
<path
d="M10.8894 7.77783C9.17358 7.77783 7.77832 9.17348 7.77832 10.8889C7.77832 12.6044 9.17358 14.0001 10.8894 14.0001C12.6053 14.0001 14.0005 12.6044 14.0005 10.8889C14.0005 9.17348 12.6053 7.77783 10.8894 7.77783ZM12.6842 10.3072L10.9342 12.2516C10.8271 12.3705 10.676 12.44 10.5157 12.4442C10.5104 12.4446 10.5058 12.4446 10.5005 12.4446C10.3464 12.4446 10.1975 12.3834 10.0881 12.2737L9.11586 11.3015C8.88798 11.0736 8.88798 10.7045 9.11586 10.4766C9.34375 10.2488 9.71289 10.2488 9.9407 10.4766L10.4785 11.014L11.8168 9.52643C12.0332 9.28797 12.4009 9.26821 12.6409 9.48311C12.8802 9.69879 12.8999 10.0675 12.6842 10.3072Z"
diff --git a/packages/ui/src/icons/nucleo/envelope-open.tsx b/packages/ui/src/icons/nucleo/envelope-open.tsx
index e65fadde4c..7b82d599ab 100644
--- a/packages/ui/src/icons/nucleo/envelope-open.tsx
+++ b/packages/ui/src/icons/nucleo/envelope-open.tsx
@@ -13,16 +13,16 @@ export function EnvelopeOpen(props: SVGProps<SVGSVGElement>) {
<path
d="M1.36133 5.25012C1.36133 4.6839 1.66933 4.19156 2.16555 3.91778L6.62455 1.45767C6.85866 1.32856 7.14177 1.32856 7.37588 1.45767L11.8349 3.91778C12.3311 4.19156 12.6391 4.68312 12.6391 5.25012"
stroke="#737373"
- stroke-width="1.5"
- stroke-linecap="round"
- stroke-linejoin="round"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
/>
<path
d="M12.6391 5.25311V10.3056C12.6391 11.165 11.943 11.8611 11.0836 11.8611H2.91688C2.05744 11.8611 1.36133 11.165 1.36133 10.3056V5.25L6.66188 7.80889C6.87577 7.91233 7.12466 7.91233 7.33777 7.80889L12.6383 5.25L12.6391 5.25311Z"
stroke="#737373"
- stroke-width="1.5"
- stroke-linecap="round"
- stroke-linejoin="round"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
/>
</svg>
);