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.

Merge branch 'main' into zapier

Steven Tey0d7a712ee8db
diff --cc apps/web/app/api/links/route.ts
index 11ba970bcf,acb2efcb6c..d506a4f356
--- a/apps/web/app/api/links/route.ts
+++ b/apps/web/app/api/links/route.ts
@@@ -1,8 -1,9 +1,10 @@@
+ import { getDomainOrThrow } from "@/lib/api/domains/get-domain-or-throw";
import { DubApiError, ErrorCodes } from "@/lib/api/errors";
import { createLink, getLinksForWorkspace, processLink } from "@/lib/api/links";
+ import { throwIfLinksUsageExceeded } from "@/lib/api/links/usage-checks";
import { parseRequestBody } from "@/lib/api/utils";
import { withWorkspace } from "@/lib/auth";
+import { qstash } from "@/lib/cron";
import { ratelimit } from "@/lib/upstash";
import {
createLinkBodySchema,
diff --cc apps/web/lib/types.ts
index 8c36c4ccaf,0f991140b7..2d40cb6171
--- a/apps/web/lib/types.ts
+++ b/apps/web/lib/types.ts
@@@ -1,8 -1,9 +1,9 @@@
import z from "@/lib/zod";
import { metaTagsSchema } from "@/lib/zod/schemas/metatags";
import { DirectorySyncProviders } from "@boxyhq/saml-jackson";
-import { Link } from "@prisma/client";
+import { Link, Project } from "@prisma/client";
import { createLinkBodySchema } from "./zod/schemas/links";
+ import { tokenSchema } from "./zod/schemas/token";
export type LinkProps = Link;
diff --cc apps/web/prisma/schema.prisma
index 3725bc4cdf,9bb76fd438..fa12a2e49f
--- a/apps/web/prisma/schema.prisma
+++ b/apps/web/prisma/schema.prisma
@@@ -93,39 -116,36 +116,40 @@@ model Project
slug String @unique
logo String?
- plan String @default("free")
- stripeId String? @unique // Stripe subscription ID
+ plan String @default("free")
+ stripeId String? @unique // Stripe subscription ID
billingCycleStart Int // day of the month when the billing cycle starts
- stripeConnectId String? @unique // for Stripe Connect
- inviteCode String? @unique
-
- usage Int @default(0)
- usageLimit Int @default(1000)
- aiUsage Int @default(0)
- aiLimit Int @default(10)
- linksUsage Int @default(0)
- linksLimit Int @default(25)
- domainsLimit Int @default(3)
- tagsLimit Int @default(5)
- usersLimit Int @default(1)
-
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- usageLastChecked DateTime @default(now())
-
- users ProjectUsers[]
- invites ProjectInvite[]
- sentEmails SentEmail[]
- links Link[]
- domains Domain[]
- tags Tag[]
- customers Customer[]
- defaultDomains DefaultDomains[]
+ stripeConnectId String? @unique // for Stripe Connect
+ inviteCode String? @unique
+
+ usage Int @default(0)
+ usageLimit Int @default(1000)
+ aiUsage Int @default(0)
+ aiLimit Int @default(10)
+ linksUsage Int @default(0)
+ linksLimit Int @default(25)
+ domainsLimit Int @default(3)
+ tagsLimit Int @default(5)
+ usersLimit Int @default(1)
+
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ usageLastChecked DateTime @default(now())
+
+ users ProjectUsers[]
+ invites ProjectInvite[]
+ sentEmails SentEmail[]
+ links Link[]
+ domains Domain[]
+ tags Tag[]
+ customers Customer[]
+ defaultDomains DefaultDomains[]
+ restrictedTokens RestrictedToken[]
+ // for Zapier integration
+ zapierHookEnabled Boolean @default(false)
+ zapierHooks ZapierHook[]
+
@@index(usageLastChecked(sort: Asc))
}