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.

478 B
Raw Blame
import { validDateRangeForPlan } from "@/lib/analytics/utils";
import { DubApiError } from "../../api/errors";

export const assertValidDateRangeForPlan = (params: {
  plan?: string | null;
  dataAvailableFrom?: Date;
  interval?: string;
  start?: Date | null;
  end?: Date | null;
}) => {
  const result = validDateRangeForPlan(params);

  if (!result.valid) {
    throw new DubApiError({
      code: "forbidden",
      message: result.message,
    });
  }

  return true;
};