mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-23 05:16:38 +00:00
Rename tiers and get working
This commit is contained in:
@@ -17,8 +17,8 @@ import { eq, and, ne } from "drizzle-orm";
|
||||
|
||||
export async function getOrgTierData(
|
||||
orgId: string
|
||||
): Promise<{ tier: "home_lab" | "starter" | "scale" | null; active: boolean }> {
|
||||
let tier: "home_lab" | "starter" | "scale" | null = null;
|
||||
): Promise<{ tier: "tier1" | "tier2" | "tier3" | null; active: boolean }> {
|
||||
let tier: "tier1" | "tier2" | "tier3" | null = null;
|
||||
let active = false;
|
||||
|
||||
if (build !== "saas") {
|
||||
@@ -50,9 +50,9 @@ export async function getOrgTierData(
|
||||
if (subscription) {
|
||||
// Validate that subscription.type is one of the expected tier values
|
||||
if (
|
||||
subscription.type === "home_lab" ||
|
||||
subscription.type === "starter" ||
|
||||
subscription.type === "scale"
|
||||
subscription.type === "tier1" ||
|
||||
subscription.type === "tier2" ||
|
||||
subscription.type === "tier3"
|
||||
) {
|
||||
tier = subscription.type;
|
||||
active = true;
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function isLicensedOrSubscribed(orgId: string): Promise<boolean> {
|
||||
|
||||
if (build === "saas") {
|
||||
const { tier, active } = await getOrgTierData(orgId);
|
||||
return (tier == "home_lab" || tier == "starter" || tier == "scale") && active;
|
||||
return (tier == "tier1" || tier == "tier2" || tier == "tier3") && active;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -17,7 +17,7 @@ import { getOrgTierData } from "#private/lib/billing";
|
||||
export async function isSubscribed(orgId: string): Promise<boolean> {
|
||||
if (build === "saas") {
|
||||
const { tier, active } = await getOrgTierData(orgId);
|
||||
return (tier == "home_lab" || tier == "starter" || tier == "scale") && active;
|
||||
return (tier == "tier1" || tier == "tier2" || tier == "tier3") && active;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user