Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: project.subscription_tier to store tier product supabase_prod_id

phamhieu01a4b6517a5c
diff --git a/studio/pages/support/new.tsx b/studio/pages/support/new.tsx
index 2f2003e7df1..05998da7d60 100644
--- a/studio/pages/support/new.tsx
+++ b/studio/pages/support/new.tsx
@@ -15,7 +15,7 @@ import SVG from 'react-inlinesvg'
import Link from 'next/link'
import { useRouter } from 'next/router'
-import { API_URL } from 'lib/constants'
+import { API_URL, PRICING_TIER_PRODUCT_IDS } from 'lib/constants'
import { useStore, withAuth } from 'hooks'
import { post, get } from 'lib/common/fetch'
import { Project } from 'types'
@@ -163,7 +163,7 @@ const SupportNew = () => {
if (x.name === 'project') {
const selectedProject = projects.find((project: any) => project.ref === x.value)
if (
- (selectedProject?.subscription_tier ?? 'FREE') === 'FREE' &&
+ (selectedProject?.subscription_tier ?? PRICING_TIER_PRODUCT_IDS.FREE) === PRICING_TIER_PRODUCT_IDS.FREE &&
formState.severity.value === 'Critical'
) {
formDispatch({
@@ -358,7 +358,7 @@ const SupportNew = () => {
(project: any) => project.ref === formState.project.value
)
const isAllowedCritical =
- (selectedProject?.subscription_tier ?? 'FREE') !== 'FREE'
+ (selectedProject?.subscription_tier ?? PRICING_TIER_PRODUCT_IDS.FREE) !== PRICING_TIER_PRODUCT_IDS.FREE
return (
<Listbox.Option
key={`option-${option.value}`}
diff --git a/studio/stores/app/ProjectStore.ts b/studio/stores/app/ProjectStore.ts
index 2c96cd1e848..4d311638f9a 100644
--- a/studio/stores/app/ProjectStore.ts
+++ b/studio/stores/app/ProjectStore.ts
@@ -54,12 +54,12 @@ export default class ProjectStore extends PostgresMetaInterface<Project> {
if (!response.error) {
const subscriptionInfo = response as {
tier: {
- key: string
+ supabase_prod_id: string
}
}
// update subscription_tier key
const clone = cloneDeep(this.data[projectId])
- clone.subscription_tier = subscriptionInfo.tier.key
+ clone.subscription_tier = subscriptionInfo.tier.supabase_prod_id
this.data[projectId] = clone
}
}
diff --git a/studio/types/base.ts b/studio/types/base.ts
index 47384047b33..687ad48faa9 100644
--- a/studio/types/base.ts
+++ b/studio/types/base.ts
@@ -30,7 +30,7 @@ export interface Project extends ProjectBase {
kpsVersion?: string
internalApiKey?: string
restUrl?: string
- // FREE, PRO or PAYG
+ // the same as stripe.products.metadata.supabase_prod_id
subscription_tier?: string
/**