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.

Fix the type

Kiran Ka00402c0941c
diff --git a/apps/web/app/api/cron/links/usage/route.ts b/apps/web/app/api/cron/links/usage/route.ts
index f51e5feacc..c329e98eb8 100644
--- a/apps/web/app/api/cron/links/usage/route.ts
+++ b/apps/web/app/api/cron/links/usage/route.ts
@@ -1,7 +1,7 @@
import { sendLimitEmail, verifySignature } from "@/lib/cron";
import { log } from "@dub/utils";
-import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
+import { WorkspaceProps } from "@/lib/types";
// Cron to update the links usage of each workspace.
// Runs once every 5 mins (*/5 * * * *)
@@ -22,6 +22,7 @@ export async function GET(req: Request) {
linksUsage: true,
linksLimit: true,
},
+ take: 30,
});
for (const workspace of workspaces) {
@@ -66,7 +67,7 @@ export async function GET(req: Request) {
await sendLimitEmail({
emails,
- workspace,
+ workspace: workspace as WorkspaceProps,
type:
percentage === 80 ? "firstLinksLimitEmail" : "secondLinksLimitEmail",
});
diff --git a/apps/web/app/api/cron/usage/utils.ts b/apps/web/app/api/cron/usage/utils.ts
index 2bc3c1a996..246760bd52 100644
--- a/apps/web/app/api/cron/usage/utils.ts
+++ b/apps/web/app/api/cron/usage/utils.ts
@@ -79,7 +79,7 @@ export const updateUsage = async (skip?: number) => {
if (!sentFirstUsageLimitEmail) {
sendLimitEmail({
emails,
- workspace,
+ workspace: workspace as unknown as WorkspaceProps,
type: "firstUsageLimitEmail",
});
} else {
@@ -95,7 +95,7 @@ export const updateUsage = async (skip?: number) => {
if (daysSinceFirstEmail >= 3) {
sendLimitEmail({
emails,
- workspace,
+ workspace: workspace as unknown as WorkspaceProps,
type: "secondUsageLimitEmail",
});
}
diff --git a/apps/web/lib/cron.ts b/apps/web/lib/cron.ts
index 997fbeefde..263ae6782a 100644
--- a/apps/web/lib/cron.ts
+++ b/apps/web/lib/cron.ts
@@ -4,7 +4,7 @@ import { sendEmail } from "emails";
import ClicksExceeded from "emails/clicks-exceeded";
import LinksLimitAlert from "emails/links-limit";
import prisma from "./prisma";
-import { Project } from "@prisma/client";
+import { WorkspaceProps } from "./types";
export const limiter = new Bottleneck({
maxConcurrent: 1, // maximum concurrent requests
@@ -44,7 +44,7 @@ export const sendLimitEmail = async ({
type,
}: {
emails: string[];
- workspace: Pick<Project, "id" | "name" | "linksUsage" | "linksLimit">;
+ workspace: WorkspaceProps;
type:
| "firstUsageLimitEmail"
| "secondUsageLimitEmail"