File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,18 +103,17 @@ export class ScheduleListPresenter extends BasePresenter {
103103 projectId,
104104 } ) ;
105105
106- const baseLimit = await getLimit ( project . organizationId , "schedules" , 100_000_000 ) ;
106+ const limit = await getLimit ( project . organizationId , "schedules" , 100_000_000 ) ;
107107 const [ currentPlan , plans ] = await Promise . all ( [
108108 getCurrentPlan ( project . organizationId ) ,
109109 getPlans ( ) ,
110110 ] ) ;
111111
112112 const extraSchedules = currentPlan ?. v3Subscription ?. addOns ?. schedules ?. purchased ?? 0 ;
113- const limit = baseLimit + extraSchedules ;
114113 const canPurchaseSchedules =
115114 currentPlan ?. v3Subscription ?. plan ?. limits . schedules . canExceed === true ;
116115 const maxScheduleQuota = currentPlan ?. v3Subscription ?. addOns ?. schedules ?. quota ?? 0 ;
117- const planScheduleLimit = currentPlan ?. v3Subscription ?. plan ?. limits . schedules . number ?? 0 ;
116+ const planScheduleLimit = limit - extraSchedules ;
118117 const schedulePricing = plans ?. addOnPricing . schedules ?? null ;
119118
120119 const purchaseInfo = {
Original file line number Diff line number Diff line change 11import { ZodError } from "zod" ;
22import { CronPattern } from "../schedules" ;
33import { BaseService , ServiceValidationError } from "./baseService.server" ;
4- import { getCurrentPlan , getLimit } from "~/services/platform.v3.server" ;
4+ import { getLimit } from "~/services/platform.v3.server" ;
55import { getTimezones } from "~/utils/timezones.server" ;
66import { env } from "~/env.server" ;
77import { type PrismaClientOrTransaction , type RuntimeEnvironmentType } from "@trigger.dev/database" ;
@@ -89,11 +89,7 @@ export class CheckScheduleService extends BaseService {
8989
9090 //if creating a schedule, check they're under the limits
9191 if ( ! schedule . friendlyId ) {
92- const baseLimit = await getLimit ( project . organizationId , "schedules" , 100_000_000 ) ;
93- const currentPlan = await getCurrentPlan ( project . organizationId ) ;
94- const purchasedSchedules =
95- currentPlan ?. v3Subscription ?. addOns ?. schedules ?. purchased ?? 0 ;
96- const limit = baseLimit + purchasedSchedules ;
92+ const limit = await getLimit ( project . organizationId , "schedules" , 100_000_000 ) ;
9793 const schedulesCount = await CheckScheduleService . getUsedSchedulesCount ( {
9894 prisma : this . _prisma ,
9995 projectId,
You can’t perform that action at this time.
0 commit comments