mirror of
https://github.com/documenso/documenso.git
synced 2026-07-25 09:25:08 +10:00
@@ -23,13 +23,6 @@ export const getServerLimits = async ({
|
||||
userId,
|
||||
teamId,
|
||||
}: GetServerLimitsOptions): Promise<TLimitsResponseSchema> => {
|
||||
if (!IS_BILLING_ENABLED()) {
|
||||
return {
|
||||
quota: SELFHOSTED_PLAN_LIMITS,
|
||||
remaining: SELFHOSTED_PLAN_LIMITS,
|
||||
};
|
||||
}
|
||||
|
||||
const organisation = await prisma.organisation.findFirst({
|
||||
where: {
|
||||
teams: {
|
||||
@@ -57,12 +50,22 @@ export const getServerLimits = async ({
|
||||
const remaining = structuredClone(FREE_PLAN_LIMITS);
|
||||
|
||||
const subscription = organisation.subscription;
|
||||
const maximumEnvelopeItemCount = organisation.organisationClaim.envelopeItemCount;
|
||||
|
||||
if (!IS_BILLING_ENABLED()) {
|
||||
return {
|
||||
quota: SELFHOSTED_PLAN_LIMITS,
|
||||
remaining: SELFHOSTED_PLAN_LIMITS,
|
||||
maximumEnvelopeItemCount,
|
||||
};
|
||||
}
|
||||
|
||||
// Bypass all limits even if plan expired for ENTERPRISE.
|
||||
if (organisation.organisationClaimId === INTERNAL_CLAIM_ID.ENTERPRISE) {
|
||||
return {
|
||||
quota: PAID_PLAN_LIMITS,
|
||||
remaining: PAID_PLAN_LIMITS,
|
||||
maximumEnvelopeItemCount,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -71,6 +74,7 @@ export const getServerLimits = async ({
|
||||
return {
|
||||
quota: INACTIVE_PLAN_LIMITS,
|
||||
remaining: INACTIVE_PLAN_LIMITS,
|
||||
maximumEnvelopeItemCount,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -80,6 +84,7 @@ export const getServerLimits = async ({
|
||||
return {
|
||||
quota: PAID_PLAN_LIMITS,
|
||||
remaining: PAID_PLAN_LIMITS,
|
||||
maximumEnvelopeItemCount,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -117,5 +122,6 @@ export const getServerLimits = async ({
|
||||
return {
|
||||
quota,
|
||||
remaining,
|
||||
maximumEnvelopeItemCount,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user