Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: refactor license code and api (#16498)

Danny Xu9accf2bc7009
diff --git a/.github/workflows/frontend-tests.yml b/.github/workflows/frontend-tests.yml
index 25786f7e04..cd05764344 100644
--- a/.github/workflows/frontend-tests.yml
+++ b/.github/workflows/frontend-tests.yml
@@ -50,7 +50,7 @@ jobs:
working-directory: frontend
- name: Copy config files
run: |
- cp ../backend/enterprise/api/plan.yaml ./src/types
+ cp ../backend/enterprise/plan.yaml ./src/types
cp ../backend/component/iam/permission.yaml ./src/types/iam
working-directory: frontend
- name: Run pnpm test
diff --git a/backend/api/v1/acl_test.go b/backend/api/v1/acl_test.go
index 10cc52cf52..ad038504ca 100644
--- a/backend/api/v1/acl_test.go
+++ b/backend/api/v1/acl_test.go
@@ -76,7 +76,7 @@ func TestGetResourceFromRequest(t *testing.T) {
},
{
request: &v1pb.UpdateSubscriptionRequest{
- Patch: &v1pb.PatchSubscription{License: "123"},
+ License: "123",
},
method: "/bytebase.v1.SubscriptionService/UpdateSubscription",
want: []*common.Resource{
diff --git a/backend/api/v1/subscription_service.go b/backend/api/v1/subscription_service.go
index 0ba6ec2892..3d7590f4a7 100644
--- a/backend/api/v1/subscription_service.go
+++ b/backend/api/v1/subscription_service.go
@@ -44,7 +44,7 @@ func (s *SubscriptionService) GetSubscription(ctx context.Context, _ *v1pb.GetSu
// UpdateSubscription updates the subscription license.
func (s *SubscriptionService) UpdateSubscription(ctx context.Context, request *v1pb.UpdateSubscriptionRequest) (*v1pb.Subscription, error) {
- if err := s.licenseService.StoreLicense(ctx, request.Patch.License); err != nil {
+ if err := s.licenseService.StoreLicense(ctx, request.License); err != nil {
if common.ErrorCode(err) == common.Invalid {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
diff --git a/backend/enterprise/license.go b/backend/enterprise/license.go
index 4333524c68..bf390ab575 100644
--- a/backend/enterprise/license.go
+++ b/backend/enterprise/license.go
@@ -3,7 +3,6 @@ package enterprise
import (
"context"
- "fmt"
"math"
"sync"
"time"
@@ -41,17 +40,9 @@ func NewLicenseService(mode common.ReleaseMode, store *store.Store) (*LicenseSer
}, nil
}
-// StoreLicense will store license into file.
-func (s *LicenseService) StoreLicense(ctx context.Context, license string) error {
- if err := s.provider.StoreLicense(ctx, license); err != nil {
- return err
- }
-
- s.RefreshCache(ctx)
- return nil
-}
-
// LoadSubscription will load subscription.
+// If there is no license, we will return a free plan subscription without expiration time.
+// If there is expired license, we will return a free plan subscription with the expiration time of the expired license.
func (s *LicenseService) LoadSubscription(ctx context.Context) *v1pb.Subscription {
s.mu.RLock()
cached := s.cachedSubscription
@@ -84,7 +75,10 @@ func (s *LicenseService) LoadSubscription(ctx context.Context) *v1pb.Subscriptio
}
// Switch to free plan if the subscription is expired.
if subscription.ExpiresTime != nil && subscription.ExpiresTime.AsTime().Before(time.Now()) {
- subscription.Plan = v1pb.PlanType_FREE
+ subscription = &v1pb.Subscription{
+ Plan: v1pb.PlanType_FREE,
+ ExpiresTime: subscription.ExpiresTime,
+ }
}
s.cachedSubscription = subscription
return subscription
@@ -101,7 +95,11 @@ func (s *LicenseService) IsFeatureEnabled(f v1pb.PlanFeature) error {
plan := s.GetEffectivePlan()
features, ok := planFeatureMatrix[plan]
if !ok || !features[f] {
- return errors.New(accessErrorMessage(f))
+ minimalPlan := v1pb.PlanType_ENTERPRISE
+ if planFeatureMatrix[v1pb.PlanType_TEAM][f] {
+ minimalPlan = v1pb.PlanType_TEAM
+ }
+ return errors.Errorf("feature %s is a %s feature, please upgrade to access it", f.String(), minimalPlan.String())
}
return nil
}
@@ -161,28 +159,16 @@ func (s *LicenseService) GetInstanceLimit(ctx context.Context) int {
return limit
}
-// RefreshCache will invalidate and refresh the subscription cache.
-func (s *LicenseService) RefreshCache(ctx context.Context) {
+// StoreLicense will store license into file.
+func (s *LicenseService) StoreLicense(ctx context.Context, license string) error {
+ if err := s.provider.StoreLicense(ctx, license); err != nil {
+ return err
+ }
+
+ // refresh the cached subscription after storing the license.
s.mu.Lock()
s.cachedSubscription = nil
s.mu.Unlock()
s.LoadSubscription(ctx)
-}
-
-// accessErrorMessage returns a error message with feature name and minimum supported plan.
-func accessErrorMessage(f v1pb.PlanFeature) string {
- plan := minimumSupportedPlan(f)
- return fmt.Sprintf("%s is a %s feature, please upgrade to access it.", f.String(), plan.String())
-}
-
-// minimumSupportedPlan will find the minimum plan which supports the target feature.
-func minimumSupportedPlan(f v1pb.PlanFeature) v1pb.PlanType {
- // Check from lowest to highest plan
- if planFeatureMatrix[v1pb.PlanType_FREE][f] {
- return v1pb.PlanType_FREE
- }
- if planFeatureMatrix[v1pb.PlanType_TEAM][f] {
- return v1pb.PlanType_TEAM
- }
- return v1pb.PlanType_ENTERPRISE
+ return nil
}
diff --git a/backend/tests/subscription.go b/backend/tests/subscription.go
index 2c6babf157..db54780500 100644
--- a/backend/tests/subscription.go
+++ b/backend/tests/subscription.go
@@ -10,7 +10,7 @@ import (
func (ctl *controller) setLicense(ctx context.Context) error {
if _, err := ctl.subscriptionServiceClient.UpdateSubscription(ctx, &v1pb.UpdateSubscriptionRequest{
- Patch: &v1pb.PatchSubscription{License: "eyJhbGciOiJSUzI1NiIsImtpZCI6InYxIiwidHlwIjoiSldUIn0.eyJpbnN0YW5jZUNvdW50Ijo5OTksInRyaWFsaW5nIjpmYWxzZSwicGxhbiI6IkVOVEVSUFJJU0UiLCJvcmdOYW1lIjoiYmIiLCJhdWQiOiJiYi5saWNlbnNlIiwiZXhwIjo3OTc0OTc5MjAwLCJpYXQiOjE2NjM2Njc1NjEsImlzcyI6ImJ5dGViYXNlIiwic3ViIjoiMDAwMDEwMDAuIn0.JjYCMeAAMB9FlVeDFLdN3jvFcqtPsbEzaIm1YEDhUrfekthCbIOeX_DB2Bg2OUji3HSX5uDvG9AkK4Gtrc4gLMPI3D5mk3L-6wUKZ0L4REztS47LT4oxVhpqPQayYa9lKJB1YoHaqeMV4Z5FXeOXwuACoELznlwpT6pXo9xXm_I6QwQiO7-zD83XOTO4PRjByc-q3GKQu_64zJMIKiCW0I8a3GvrdSnO7jUuYU1KPmCuk0ZRq3I91m29LTo478BMST59HqCLj1GGuCKtR3SL_376XsZfUUM0iSAur5scg99zNGWRj-sUo05wbAadYx6V6TKaWrBUi_8_0RnJyP5gbA"},
+ License: "eyJhbGciOiJSUzI1NiIsImtpZCI6InYxIiwidHlwIjoiSldUIn0.eyJpbnN0YW5jZUNvdW50Ijo5OTksInRyaWFsaW5nIjpmYWxzZSwicGxhbiI6IkVOVEVSUFJJU0UiLCJvcmdOYW1lIjoiYmIiLCJhdWQiOiJiYi5saWNlbnNlIiwiZXhwIjo3OTc0OTc5MjAwLCJpYXQiOjE2NjM2Njc1NjEsImlzcyI6ImJ5dGViYXNlIiwic3ViIjoiMDAwMDEwMDAuIn0.JjYCMeAAMB9FlVeDFLdN3jvFcqtPsbEzaIm1YEDhUrfekthCbIOeX_DB2Bg2OUji3HSX5uDvG9AkK4Gtrc4gLMPI3D5mk3L-6wUKZ0L4REztS47LT4oxVhpqPQayYa9lKJB1YoHaqeMV4Z5FXeOXwuACoELznlwpT6pXo9xXm_I6QwQiO7-zD83XOTO4PRjByc-q3GKQu_64zJMIKiCW0I8a3GvrdSnO7jUuYU1KPmCuk0ZRq3I91m29LTo478BMST59HqCLj1GGuCKtR3SL_376XsZfUUM0iSAur5scg99zNGWRj-sUo05wbAadYx6V6TKaWrBUi_8_0RnJyP5gbA",
}); err != nil {
return errors.Wrap(err, "failed to remove license")
}
@@ -19,7 +19,7 @@ func (ctl *controller) setLicense(ctx context.Context) error {
func (ctl *controller) removeLicense(ctx context.Context) error {
if _, err := ctl.subscriptionServiceClient.UpdateSubscription(ctx, &v1pb.UpdateSubscriptionRequest{
- Patch: &v1pb.PatchSubscription{License: ""},
+ License: "",
}); err != nil {
return errors.Wrap(err, "failed to remove license")
}
diff --git a/frontend/scripts/copy_config_files.sh b/frontend/scripts/copy_config_files.sh
index d7e190971d..1f4de60e36 100644
--- a/frontend/scripts/copy_config_files.sh
+++ b/frontend/scripts/copy_config_files.sh
@@ -1,3 +1,3 @@
#!/bin/sh
-cp ../backend/enterprise/api/plan.yaml ./src/types/
+cp ../backend/enterprise/plan.yaml ./src/types/
cp ../backend/component/iam/permission.yaml ./src/types/iam/
diff --git a/frontend/src/components/FeatureGuard/FeatureAttention.vue b/frontend/src/components/FeatureGuard/FeatureAttention.vue
index d8386629f3..6182357297 100644
--- a/frontend/src/components/FeatureGuard/FeatureAttention.vue
+++ b/frontend/src/components/FeatureGuard/FeatureAttention.vue
@@ -24,7 +24,7 @@
import { BBAttention } from "@/bbkit";
import { useLanguage } from "@/composables/useLanguage";
import { useActuatorV1Store, useSubscriptionV1Store } from "@/store";
-import { ENTERPRISE_INQUIRE_LINK, instanceLimitFeature, planTypeToString } from "@/types";
+import { ENTERPRISE_INQUIRE_LINK, instanceLimitFeature } from "@/types";
import type {
Instance,
InstanceResource,
@@ -147,7 +147,7 @@ const descriptionText = computed(() => {
}
const trialText = t("subscription.required-plan-with-trial", {
requiredPlan: t(
- `subscription.plan.${planTypeToString(requiredPlan)}.title`
+ `subscription.plan.${requiredPlan.toLowerCase()}.title`
),
startTrial: startTrial,
});
diff --git a/frontend/src/components/FeatureGuard/FeatureBadge.vue b/frontend/src/components/FeatureGuard/FeatureBadge.vue
index e59f07a683..cd15db3388 100644
--- a/frontend/src/components/FeatureGuard/FeatureBadge.vue
+++ b/frontend/src/components/FeatureGuard/FeatureBadge.vue
@@ -40,9 +40,9 @@
{{
$t("subscription.require-subscription", {
requiredPlan: $t(
- `subscription.plan.${planTypeToString(
- subscriptionStore.getMinimumRequiredPlan(feature)
- )}.title`
+ `subscription.plan.${
+ subscriptionStore.getMinimumRequiredPlan(feature).toLowerCase()
+ }.title`
),
})
}}
@@ -60,7 +60,6 @@
import { NTooltip } from "naive-ui";
import { reactive, computed } from "vue";
import { useSubscriptionV1Store } from "@/store";
-import { planTypeToString } from "@/types";
import type {
Instance,
InstanceResource,
diff --git a/frontend/src/components/FeatureGuard/FeatureModal.vue b/frontend/src/components/FeatureGuard/FeatureModal.vue
index e79cf32600..8a3db1d4cf 100644
--- a/frontend/src/components/FeatureGuard/FeatureModal.vue
+++ b/frontend/src/components/FeatureGuard/FeatureModal.vue
@@ -35,7 +35,7 @@
<span class="font-bold text-accent">
{{
$t(
- `subscription.plan.${planTypeToString(requiredPlan)}.title`
+ `subscription.plan.${requiredPlan.toLowerCase()}.title`
)
}}
</span>
@@ -100,7 +100,7 @@
import { BBModal } from "@/bbkit";
import { useLanguage } from "@/composables/useLanguage";
import { useSubscriptionV1Store } from "@/store";
-import { ENTERPRISE_INQUIRE_LINK, planTypeToString } from "@/types";
+import { ENTERPRISE_INQUIRE_LINK } from "@/types";
import type {
Instance,
InstanceResource,
diff --git a/frontend/src/components/SQLReview/components/SQLRuleTable.vue b/frontend/src/components/SQLReview/components/SQLRuleTable.vue
index 1d9e4e863f..62524b1829 100644
--- a/frontend/src/components/SQLReview/components/SQLRuleTable.vue
+++ b/frontend/src/components/SQLReview/components/SQLRuleTable.vue
@@ -54,9 +54,9 @@
{{
$t("sql-review.not-available-for-free", {
plan: $t(
- `subscription.plan.${planTypeToString(
- currentPlan
- )}.title`
+ `subscription.plan.${
+ currentPlan.toLowerCase()
+ }.title`
),
})
}}
@@ -134,7 +134,6 @@ import type { RuleTemplateV2 } from "@/types";
import {
getRuleLocalization,
ruleIsAvailableInSubscription,
- planTypeToString,
} from "@/types";
import { SQLReviewRuleLevel } from "@/types/proto/v1/org_policy_service";
import RuleConfig from "./RuleConfigComponents/RuleConfig.vue";
diff --git a/frontend/src/components/SSO/IdentityProviderCreateForm.vue b/frontend/src/components/SSO/IdentityProviderCreateForm.vue
index a87760ab11..7d5610c999 100644
--- a/frontend/src/components/SSO/IdentityProviderCreateForm.vue
+++ b/frontend/src/components/SSO/IdentityProviderCreateForm.vue
@@ -52,9 +52,9 @@
{{
$t("subscription.require-subscription", {
requiredPlan: $t(
- `subscription.plan.${planTypeToString(
- item.minimumRequiredPlan
- )}.title`
+ `subscription.plan.${
+ item.minimumRequiredPlan.toLowerCase()
+ }.title`
),
})
}}
@@ -130,9 +130,9 @@
{{
$t("subscription.require-subscription", {
requiredPlan: $t(
- `subscription.plan.${planTypeToString(
- template.minimumRequiredPlan
- )}.title`
+ `subscription.plan.${
+ template.minimumRequiredPlan.toLowerCase()
+ }.title`
),
})
}}
@@ -726,7 +726,6 @@ import {
idpNamePrefix,
} from "@/store/modules/v1/common";
import type { OAuthWindowEventPayload } from "@/types";
-import { planTypeToString } from "@/types";
import {
FieldMapping,
IdentityProvider,
diff --git a/frontend/src/components/TrialModal.vue b/frontend/src/components/TrialModal.vue
index f2ccf6558d..56d1f8a75a 100644
--- a/frontend/src/components/TrialModal.vue
+++ b/frontend/src/components/TrialModal.vue
@@ -17,9 +17,9 @@
<span class="font-bold text-accent">
{{
$t(
- `subscription.plan.${planTypeToString(
- PlanType.ENTERPRISE
- )}.title`
+ `subscription.plan.${
+ PlanType.ENTERPRISE.toLowerCase()
+ }.title`
)
}}
</span>
@@ -56,7 +56,7 @@ import { BBModal } from "@/bbkit";
import { useLanguage } from "@/composables/useLanguage";
import { SETTING_ROUTE_WORKSPACE_SUBSCRIPTION } from "@/router/dashboard/workspaceSetting";
import { useSubscriptionV1Store } from "@/store";
-import { ENTERPRISE_INQUIRE_LINK, planTypeToString } from "@/types";
+import { ENTERPRISE_INQUIRE_LINK } from "@/types";
import { PlanType } from "@/types/proto/v1/subscription_service";
import { NButton } from "naive-ui";
import { reactive } from "vue";
diff --git a/frontend/src/store/modules/v1/subscription.ts b/frontend/src/store/modules/v1/subscription.ts
index 6fd98aefd9..6198828650 100644
--- a/frontend/src/store/modules/v1/subscription.ts
+++ b/frontend/src/store/modules/v1/subscription.ts
@@ -203,9 +203,7 @@ export const useSubscriptionV1Store = defineStore("subscription_v1", {
},
async patchSubscription(license: string) {
const subscription = await subscriptionServiceClient.updateSubscription({
- patch: {
- license,
- },
+ license,
});
this.setSubscription(subscription);
return subscription;
diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.ts
index 3e413df611..c234d88f24 100644
--- a/frontend/src/types/plan.ts
+++ b/frontend/src/types/plan.ts
@@ -1,51 +1,29 @@
import {
+ PlanFeature,
PlanType,
type PlanConfig,
- type PlanLimitConfig,
- PlanFeature,
+ type PlanLimitConfig
} from "@/types/proto/v1/subscription_service";
import planData from "./plan.yaml";
-// Use proto Feature enum as the primary feature type
-export type Feature = PlanFeature;
-
-// Instance-limited features that require activated instances
-export const instanceLimitFeature = new Set<PlanFeature>([
- PlanFeature.FEATURE_DATABASE_SECRET_VARIABLES,
- PlanFeature.FEATURE_INSTANCE_READ_ONLY_CONNECTION,
- PlanFeature.FEATURE_DATA_MASKING,
-]);
-
-export const planTypeToString = (planType: PlanType): string => {
- switch (planType) {
- case PlanType.FREE:
- return "free";
- case PlanType.TEAM:
- return "team";
- case PlanType.ENTERPRISE:
- return "enterprise";
- default:
- return "";
- }
-};
-
-// Re-export proto types for convenience
-export type { PlanConfig, PlanLimitConfig };
-
-export const PLAN_CONFIG: PlanConfig = planData;
export const PLANS: PlanLimitConfig[] = planData.plans;
// Create a plan feature matrix from the YAML data
-export const PLAN_FEATURE_MATRIX = new Map<PlanType, Set<PlanFeature>>();
+const planFeatureMatrix = new Map<PlanType, Set<PlanFeature>>();
+// Instance-limited features that require activated instances
+export const instanceLimitFeature = new Set<PlanFeature>();
-// Initialize the feature matrix from plan data
+// Initialize the feature matrix and instance features from plan data
PLANS.forEach((plan) => {
- PLAN_FEATURE_MATRIX.set(plan.type, new Set(plan.features));
+ planFeatureMatrix.set(plan.type, new Set(plan.features));
+});
+(planData as PlanConfig).instanceFeatures.forEach((feature) => {
+ instanceLimitFeature.add(feature);
});
// Helper function to check if a plan has a feature
export const planHasFeature = (plan: PlanType, feature: PlanFeature): boolean => {
- const planFeatures = PLAN_FEATURE_MATRIX.get(plan);
+ const planFeatures = planFeatureMatrix.get(plan);
return planFeatures?.has(feature) ?? false;
};
diff --git a/frontend/src/types/proto-es/v1/subscription_service_pb.d.ts b/frontend/src/types/proto-es/v1/subscription_service_pb.d.ts
index 1d4c747ca0..6e68972089 100644
--- a/frontend/src/types/proto-es/v1/subscription_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/subscription_service_pb.d.ts
@@ -28,9 +28,9 @@ export declare const GetSubscriptionRequestSchema: GenMessage<GetSubscriptionReq
*/
export declare type UpdateSubscriptionRequest = Message<"bytebase.v1.UpdateSubscriptionRequest"> & {
/**
- * @generated from field: bytebase.v1.PatchSubscription patch = 1;
+ * @generated from field: string license = 1;
*/
- patch?: PatchSubscription;
+ license: string;
};
/**
@@ -39,22 +39,6 @@ export declare type UpdateSubscriptionRequest = Message<"bytebase.v1.UpdateSubsc
*/
export declare const UpdateSubscriptionRequestSchema: GenMessage<UpdateSubscriptionRequest>;
-/**
- * @generated from message bytebase.v1.PatchSubscription
- */
-export declare type PatchSubscription = Message<"bytebase.v1.PatchSubscription"> & {
- /**
- * @generated from field: string license = 1;
- */
- license: string;
-};
-
-/**
- * Describes the message bytebase.v1.PatchSubscription.
- * Use `create(PatchSubscriptionSchema)` to create a new message.
- */
-export declare const PatchSubscriptionSchema: GenMessage<PatchSubscription>;
-
/**
* @generated from message bytebase.v1.Subscription
*/
@@ -577,6 +561,10 @@ export declare const PlanFeatureSchema: GenEnum<PlanFeature>;
*/
export declare const SubscriptionService: GenService<{
/**
+ * GetSubscription returns the current subscription.
+ * If there is no license, we will return a free plan subscription without expiration time.
+ * If there is expired license, we will return a free plan subscription with the expiration time of the expired license.
+ *
* @generated from rpc bytebase.v1.SubscriptionService.GetSubscription
*/
getSubscription: {
diff --git a/frontend/src/types/proto-es/v1/subscription_service_pb.js b/frontend/src/types/proto-es/v1/subscription_service_pb.js
index a0587e030d..c3aecb60c2 100644
--- a/frontend/src/types/proto-es/v1/subscription_service_pb.js
+++ b/frontend/src/types/proto-es/v1/subscription_service_pb.js
@@ -13,7 +13,7 @@ import { file_v1_annotation } from "./annotation_pb";
* Describes the file v1/subscription_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V9NU0EQRhIdChlGRUFUVVJFX0NPTU1VTklUWV9TVVBQT1JUEEcSGQoVRkVBVFVSRV9FTUFJTF9TVVBQT1JUEEgSJgoiRkVBVFVSRV9ERURJQ0FURURfU1VQUE9SVF9XSVRIX1NMQRBJMqMCChNTdWJzY3JpcHRpb25TZXJ2aWNlEnIKD0dldFN1YnNjcmlwdGlvbhIjLmJ5dGViYXNlLnYxLkdldFN1YnNjcmlwdGlvblJlcXVlc3QaGS5ieXRlYmFzZS52MS5TdWJzY3JpcHRpb24iH9pBAIDqMAGC0+STAhISEC92MS9zdWJzY3JpcHRpb24SlwEKElVwZGF0ZVN1YnNjcmlwdGlvbhImLmJ5dGViYXNlLnYxLlVwZGF0ZVN1YnNjcmlwdGlvblJlcXVlc3QaGS5ieXRlYmFzZS52MS5TdWJzY3JpcHRpb24iPtpBBXBhdGNoiuowD2JiLnNldHRpbmdzLnNldJDqMAGC0+STAhk6BXBhdGNoMhAvdjEvc3Vic2NyaXB0aW9uQjRaMmdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvcHJvdG8vZ2VuZXJhdGVkLWdvL3YxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_timestamp, file_v1_annotation]);
+ fileDesc("Ch12MS9zdWJzY3JpcHRpb25fc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiGAoWR2V0U3Vic2NyaXB0aW9uUmVxdWVzdCIsChlVcGRhdGVTdWJzY3JpcHRpb25SZXF1ZXN0Eg8KB2xpY2Vuc2UYASABKAki2QEKDFN1YnNjcmlwdGlvbhIYCgpzZWF0X2NvdW50GAEgASgFQgTiQQEDEhwKDmluc3RhbmNlX2NvdW50GAIgASgFQgTiQQEDEjYKDGV4cGlyZXNfdGltZRgDIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCBOJBAQMSKQoEcGxhbhgEIAEoDjIVLmJ5dGViYXNlLnYxLlBsYW5UeXBlQ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3Vic2NyaXB0aW9uQjRaMmdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvcHJvdG8vZ2VuZXJhdGVkLWdvL3YxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_timestamp, file_v1_annotation]);
/**
* Describes the message bytebase.v1.GetSubscriptionRequest.
@@ -29,33 +29,26 @@ export const GetSubscriptionRequestSchema = /*@__PURE__*/
export const UpdateSubscriptionRequestSchema = /*@__PURE__*/
messageDesc(file_v1_subscription_service, 1);
-/**
- * Describes the message bytebase.v1.PatchSubscription.
- * Use `create(PatchSubscriptionSchema)` to create a new message.
- */
-export const PatchSubscriptionSchema = /*@__PURE__*/
- messageDesc(file_v1_subscription_service, 2);
-
/**
* Describes the message bytebase.v1.Subscription.
* Use `create(SubscriptionSchema)` to create a new message.
*/
export const SubscriptionSchema = /*@__PURE__*/
- messageDesc(file_v1_subscription_service, 3);
+ messageDesc(file_v1_subscription_service, 2);
/**
* Describes the message bytebase.v1.PlanConfig.
* Use `create(PlanConfigSchema)` to create a new message.
*/
export const PlanConfigSchema = /*@__PURE__*/
- messageDesc(file_v1_subscription_service, 4);
+ messageDesc(file_v1_subscription_service, 3);
/**
* Describes the message bytebase.v1.PlanLimitConfig.
* Use `create(PlanLimitConfigSchema)` to create a new message.
*/
export const PlanLimitConfigSchema = /*@__PURE__*/
- messageDesc(file_v1_subscription_service, 5);
+ messageDesc(file_v1_subscription_service, 4);
/**
* Describes the enum bytebase.v1.PlanType.
diff --git a/frontend/src/types/proto/v1/subscription_service.ts b/frontend/src/types/proto/v1/subscription_service.ts
index 51b38cfbeb..62b06a2305 100644
--- a/frontend/src/types/proto/v1/subscription_service.ts
+++ b/frontend/src/types/proto/v1/subscription_service.ts
@@ -702,10 +702,6 @@ export interface GetSubscriptionRequest {
}
export interface UpdateSubscriptionRequest {
- patch: PatchSubscription | undefined;
-}
-
-export interface PatchSubscription {
license: string;
}
@@ -776,13 +772,13 @@ export const GetSubscriptionRequest: MessageFns<GetSubscriptionRequest> = {
};
function createBaseUpdateSubscriptionRequest(): UpdateSubscriptionRequest {
- return { patch: undefined };
+ return { license: "" };
}
export const UpdateSubscriptionRequest: MessageFns<UpdateSubscriptionRequest> = {
encode(message: UpdateSubscriptionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.patch !== undefined) {
- PatchSubscription.encode(message.patch, writer.uint32(10).fork()).join();
+ if (message.license !== "") {
+ writer.uint32(10).string(message.license);
}
return writer;
},
@@ -799,7 +795,7 @@ export const UpdateSubscriptionRequest: MessageFns<UpdateSubscriptionRequest> =
break;
}
- message.patch = PatchSubscription.decode(reader, reader.uint32());
+ message.license = reader.string();
continue;
}
}
@@ -812,13 +808,13 @@ export const UpdateSubscriptionRequest: MessageFns<UpdateSubscriptionRequest> =
},
fromJSON(object: any): UpdateSubscriptionRequest {
- return { patch: isSet(object.patch) ? PatchSubscription.fromJSON(object.patch) : undefined };
+ return { license: isSet(object.license) ? globalThis.String(object.license) : "" };
},
toJSON(message: UpdateSubscriptionRequest): unknown {
const obj: any = {};
- if (message.patch !== undefined) {
- obj.patch = PatchSubscription.toJSON(message.patch);
+ if (message.license !== "") {
+ obj.license = message.license;
}
return obj;
},
@@ -828,66 +824,6 @@ export const UpdateSubscriptionRequest: MessageFns<UpdateSubscriptionRequest> =
},
fromPartial(object: DeepPartial<UpdateSubscriptionRequest>): UpdateSubscriptionRequest {
const message = createBaseUpdateSubscriptionRequest();
- message.patch = (object.patch !== undefined && object.patch !== null)
- ? PatchSubscription.fromPartial(object.patch)
- : undefined;
- return message;
- },
-};
-
-function createBasePatchSubscription(): PatchSubscription {
- return { license: "" };
-}
-
-export const PatchSubscription: MessageFns<PatchSubscription> = {
- encode(message: PatchSubscription, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.license !== "") {
- writer.uint32(10).string(message.license);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): PatchSubscription {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBasePatchSubscription();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.license = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): PatchSubscription {
- return { license: isSet(object.license) ? globalThis.String(object.license) : "" };
- },
-
- toJSON(message: PatchSubscription): unknown {
- const obj: any = {};
- if (message.license !== "") {
- obj.license = message.license;
- }
- return obj;
- },
-
- create(base?: DeepPartial<PatchSubscription>): PatchSubscription {
- return PatchSubscription.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<PatchSubscription>): PatchSubscription {
- const message = createBasePatchSubscription();
message.license = object.license ?? "";
return message;
},
@@ -1259,6 +1195,11 @@ export const SubscriptionServiceDefinition = {
name: "SubscriptionService",
fullName: "bytebase.v1.SubscriptionService",
methods: {
+ /**
+ * GetSubscription returns the current subscription.
+ * If there is no license, we will return a free plan subscription without expiration time.
+ * If there is expired license, we will return a free plan subscription with the expiration time of the expired license.
+ */
getSubscription: {
name: "GetSubscription",
requestType: GetSubscriptionRequest,
@@ -1288,14 +1229,16 @@ export const SubscriptionServiceDefinition = {
800016: [new Uint8Array([1])],
578365826: [
new Uint8Array([
- 25,
+ 27,
58,
- 5,
- 112,
- 97,
- 116,
+ 7,
+ 108,
+ 105,
99,
- 104,
+ 101,
+ 110,
+ 115,
+ 101,
50,
16,
47,
diff --git a/frontend/src/views/BannerUpgradeSubscription.vue b/frontend/src/views/BannerUpgradeSubscription.vue
index 34e3ef4e31..d08e938b7d 100644
--- a/frontend/src/views/BannerUpgradeSubscription.vue
+++ b/frontend/src/views/BannerUpgradeSubscription.vue
@@ -16,7 +16,7 @@
>{{
t("subscription.plan-features", {
plan: t(
- `subscription.plan.${planTypeToString(neededPlan)}.title`
+ `subscription.plan.${neededPlan.toLowerCase()}.title`
),
})
}}</span
@@ -54,9 +54,9 @@
}}
({{
$t(
- `subscription.plan.${planTypeToString(
- subscriptionStore.getMinimumRequiredPlan(feature as PlanFeature)
- )}.title`
+ `subscription.plan.${
+ subscriptionStore.getMinimumRequiredPlan(feature as PlanFeature).toLowerCase()
+ }.title`
)
}})
</li>
@@ -74,7 +74,6 @@
import { BBModal } from "@/bbkit";
import { SETTING_ROUTE_WORKSPACE_SUBSCRIPTION } from "@/router/dashboard/workspaceSetting";
import { useActuatorV1Store, useSubscriptionV1Store } from "@/store";
-import { planTypeToString } from "@/types";
import {
PlanFeature, PlanType,
planTypeToNumber
@@ -125,7 +124,7 @@ const neededPlan = computed(() => {
const currentPlan = computed(() => {
return t(
- `subscription.plan.${planTypeToString(subscriptionStore.currentPlan)}.title`
+ `subscription.plan.${subscriptionStore.currentPlan.toLowerCase()}.title`
);
});
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index b58d7bbcac..b8f6b2688b 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -7051,6 +7051,10 @@ paths:
get:
tags:
- SubscriptionService
+ description: |-
+ GetSubscription returns the current subscription.
+ If there is no license, we will return a free plan subscription without expiration time.
+ If there is expired license, we will return a free plan subscription with the expiration time of the expired license.
operationId: SubscriptionService_GetSubscription
responses:
"200":
@@ -7073,7 +7077,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/PatchSubscription'
+ type: string
required: true
responses:
"200":
@@ -11159,11 +11163,6 @@ components:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
description: password_rotation requires users to reset their password after the duration.
- PatchSubscription:
- type: object
- properties:
- license:
- type: string
Plan:
type: object
properties:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 94fb7a6078..8fd47e8070 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -207,7 +207,6 @@
- [v1/subscription_service.proto](#v1_subscription_service-proto)
- [GetSubscriptionRequest](#bytebase-v1-GetSubscriptionRequest)
- - [PatchSubscription](#bytebase-v1-PatchSubscription)
- [PlanConfig](#bytebase-v1-PlanConfig)
- [PlanLimitConfig](#bytebase-v1-PlanLimitConfig)
- [Subscription](#bytebase-v1-Subscription)
@@ -3930,21 +3929,6 @@ ANY means approving any node will proceed.
-<a name="bytebase-v1-PatchSubscription"></a>
-
-### PatchSubscription
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| license | [string](#string) | | |
-
-
-
-
-
-
<a name="bytebase-v1-PlanConfig"></a>
### PlanConfig
@@ -4007,7 +3991,7 @@ PlanLimitConfig represents a single plan&#39;s configuration
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| patch | [PatchSubscription](#bytebase-v1-PatchSubscription) | | |
+| license | [string](#string) | | |
@@ -4125,7 +4109,7 @@ PlanFeature represents the available features in Bytebase
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
-| GetSubscription | [GetSubscriptionRequest](#bytebase-v1-GetSubscriptionRequest) | [Subscription](#bytebase-v1-Subscription) | |
+| GetSubscription | [GetSubscriptionRequest](#bytebase-v1-GetSubscriptionRequest) | [Subscription](#bytebase-v1-Subscription) | GetSubscription returns the current subscription. If there is no license, we will return a free plan subscription without expiration time. If there is expired license, we will return a free plan subscription with the expiration time of the expired license. |
| UpdateSubscription | [UpdateSubscriptionRequest](#bytebase-v1-UpdateSubscriptionRequest) | [Subscription](#bytebase-v1-Subscription) | |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index f185437370..74ebc049af 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -967,10 +967,6 @@
<a href="#bytebase.v1.GetSubscriptionRequest"><span class="badge">M</span>GetSubscriptionRequest</a>
</li>
- <li>
- <a href="#bytebase.v1.PatchSubscription"><span class="badge">M</span>PatchSubscription</a>
- </li>
-
<li>
<a href="#bytebase.v1.PlanConfig"><span class="badge">M</span>PlanConfig</a>
</li>
@@ -11811,30 +11807,6 @@ The access is based on approval flow.</p></td>
- <h3 id="bytebase.v1.PatchSubscription">PatchSubscription</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>license</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
<h3 id="bytebase.v1.PlanConfig">PlanConfig</h3>
<p>PlanConfig represents the configuration for all plans loaded from plan.yaml</p>
@@ -11981,8 +11953,8 @@ The access is based on approval flow.</p></td>
<tbody>
<tr>
- <td>patch</td>
- <td><a href="#bytebase.v1.PatchSubscription">PatchSubscription</a></td>
+ <td>license</td>
+ <td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
@@ -12502,7 +12474,9 @@ The access is based on approval flow.</p></td>
<td>GetSubscription</td>
<td><a href="#bytebase.v1.GetSubscriptionRequest">GetSubscriptionRequest</a></td>
<td><a href="#bytebase.v1.Subscription">Subscription</a></td>
- <td><p></p></td>
+ <td><p>GetSubscription returns the current subscription.
+If there is no license, we will return a free plan subscription without expiration time.
+If there is expired license, we will return a free plan subscription with the expiration time of the expired license.</p></td>
</tr>
<tr>
@@ -12546,7 +12520,7 @@ The access is based on approval flow.</p></td>
<td>UpdateSubscription</td>
<td>PATCH</td>
<td>/v1/subscription</td>
- <td>patch</td>
+ <td>license</td>
</tr>
diff --git a/proto/generated-go/v1/subscription_service.pb.go b/proto/generated-go/v1/subscription_service.pb.go
index f858612ce4..39e382eb9c 100644
--- a/proto/generated-go/v1/subscription_service.pb.go
+++ b/proto/generated-go/v1/subscription_service.pb.go
@@ -380,7 +380,7 @@ func (*GetSubscriptionRequest) Descriptor() ([]byte, []int) {
type UpdateSubscriptionRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
- Patch *PatchSubscription `protobuf:"bytes,1,opt,name=patch,proto3" json:"patch,omitempty"`
+ License string `protobuf:"bytes,1,opt,name=license,proto3" json:"license,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -415,51 +415,7 @@ func (*UpdateSubscriptionRequest) Descriptor() ([]byte, []int) {
return file_v1_subscription_service_proto_rawDescGZIP(), []int{1}
}
-func (x *UpdateSubscriptionRequest) GetPatch() *PatchSubscription {
- if x != nil {
- return x.Patch
- }
- return nil
-}
-
-type PatchSubscription struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- License string `protobuf:"bytes,1,opt,name=license,proto3" json:"license,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *PatchSubscription) Reset() {
- *x = PatchSubscription{}
- mi := &file_v1_subscription_service_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *PatchSubscription) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*PatchSubscription) ProtoMessage() {}
-
-func (x *PatchSubscription) ProtoReflect() protoreflect.Message {
- mi := &file_v1_subscription_service_proto_msgTypes[2]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use PatchSubscription.ProtoReflect.Descriptor instead.
-func (*PatchSubscription) Descriptor() ([]byte, []int) {
- return file_v1_subscription_service_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *PatchSubscription) GetLicense() string {
+func (x *UpdateSubscriptionRequest) GetLicense() string {
if x != nil {
return x.License
}
@@ -480,7 +436,7 @@ type Subscription struct {
func (x *Subscription) Reset() {
*x = Subscription{}
- mi := &file_v1_subscription_service_proto_msgTypes[3]
+ mi := &file_v1_subscription_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -492,7 +448,7 @@ func (x *Subscription) String() string {
func (*Subscription) ProtoMessage() {}
func (x *Subscription) ProtoReflect() protoreflect.Message {
- mi := &file_v1_subscription_service_proto_msgTypes[3]
+ mi := &file_v1_subscription_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -505,7 +461,7 @@ func (x *Subscription) ProtoReflect() protoreflect.Message {
// Deprecated: Use Subscription.ProtoReflect.Descriptor instead.
func (*Subscription) Descriptor() ([]byte, []int) {
- return file_v1_subscription_service_proto_rawDescGZIP(), []int{3}
+ return file_v1_subscription_service_proto_rawDescGZIP(), []int{2}
}
func (x *Subscription) GetSeatCount() int32 {
@@ -561,7 +517,7 @@ type PlanConfig struct {
func (x *PlanConfig) Reset() {
*x = PlanConfig{}
- mi := &file_v1_subscription_service_proto_msgTypes[4]
+ mi := &file_v1_subscription_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -573,7 +529,7 @@ func (x *PlanConfig) String() string {
func (*PlanConfig) ProtoMessage() {}
func (x *PlanConfig) ProtoReflect() protoreflect.Message {
- mi := &file_v1_subscription_service_proto_msgTypes[4]
+ mi := &file_v1_subscription_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -586,7 +542,7 @@ func (x *PlanConfig) ProtoReflect() protoreflect.Message {
// Deprecated: Use PlanConfig.ProtoReflect.Descriptor instead.
func (*PlanConfig) Descriptor() ([]byte, []int) {
- return file_v1_subscription_service_proto_rawDescGZIP(), []int{4}
+ return file_v1_subscription_service_proto_rawDescGZIP(), []int{3}
}
func (x *PlanConfig) GetPlans() []*PlanLimitConfig {
@@ -616,7 +572,7 @@ type PlanLimitConfig struct {
func (x *PlanLimitConfig) Reset() {
*x = PlanLimitConfig{}
- mi := &file_v1_subscription_service_proto_msgTypes[5]
+ mi := &file_v1_subscription_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -628,7 +584,7 @@ func (x *PlanLimitConfig) String() string {
func (*PlanLimitConfig) ProtoMessage() {}
func (x *PlanLimitConfig) ProtoReflect() protoreflect.Message {
- mi := &file_v1_subscription_service_proto_msgTypes[5]
+ mi := &file_v1_subscription_service_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -641,7 +597,7 @@ func (x *PlanLimitConfig) ProtoReflect() protoreflect.Message {
// Deprecated: Use PlanLimitConfig.ProtoReflect.Descriptor instead.
func (*PlanLimitConfig) Descriptor() ([]byte, []int) {
- return file_v1_subscription_service_proto_rawDescGZIP(), []int{5}
+ return file_v1_subscription_service_proto_rawDescGZIP(), []int{4}
}
func (x *PlanLimitConfig) GetType() PlanType {
@@ -677,10 +633,8 @@ var File_v1_subscription_service_proto protoreflect.FileDescriptor
const file_v1_subscription_service_proto_rawDesc = "" +
"\n" +
"\x1dv1/subscription_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\"\x18\n" +
- "\x16GetSubscriptionRequest\"Q\n" +
- "\x19UpdateSubscriptionRequest\x124\n" +
- "\x05patch\x18\x01 \x01(\v2\x1e.bytebase.v1.PatchSubscriptionR\x05patch\"-\n" +
- "\x11PatchSubscription\x12\x18\n" +
+ "\x16GetSubscriptionRequest\"5\n" +
+ "\x19UpdateSubscriptionRequest\x12\x18\n" +
"\alicense\x18\x01 \x01(\tR\alicense\"\x99\x02\n" +
"\fSubscription\x12#\n" +
"\n" +
@@ -780,10 +734,10 @@ const file_v1_subscription_service_proto_rawDesc = "" +
"\x12FEATURE_CUSTOM_MSA\x10F\x12\x1d\n" +
"\x19FEATURE_COMMUNITY_SUPPORT\x10G\x12\x19\n" +
"\x15FEATURE_EMAIL_SUPPORT\x10H\x12&\n" +
- "\"FEATURE_DEDICATED_SUPPORT_WITH_SLA\x10I2\xa3\x02\n" +
+ "\"FEATURE_DEDICATED_SUPPORT_WITH_SLA\x10I2\xa5\x02\n" +
"\x13SubscriptionService\x12r\n" +
- "\x0fGetSubscription\x12#.bytebase.v1.GetSubscriptionRequest\x1a\x19.bytebase.v1.Subscription\"\x1f\xdaA\x00\x80\xea0\x01\x82\xd3\xe4\x93\x02\x12\x12\x10/v1/subscription\x12\x97\x01\n" +
- "\x12UpdateSubscription\x12&.bytebase.v1.UpdateSubscriptionRequest\x1a\x19.bytebase.v1.Subscription\">\xdaA\x05patch\x8a\xea0\x0fbb.settings.set\x90\xea0\x01\x82\xd3\xe4\x93\x02\x19:\x05patch2\x10/v1/subscriptionB4Z2github.com/bytebase/bytebase/proto/generated-go/v1b\x06proto3"
+ "\x0fGetSubscription\x12#.bytebase.v1.GetSubscriptionRequest\x1a\x19.bytebase.v1.Subscription\"\x1f\xdaA\x00\x80\xea0\x01\x82\xd3\xe4\x93\x02\x12\x12\x10/v1/subscription\x12\x99\x01\n" +
+ "\x12UpdateSubscription\x12&.bytebase.v1.UpdateSubscriptionRequest\x1a\x19.bytebase.v1.Subscription\"@\xdaA\x05patch\x8a\xea0\x0fbb.settings.set\x90\xea0\x01\x82\xd3\xe4\x93\x02\x1b:\alicense2\x10/v1/subscriptionB4Z2github.com/bytebase/bytebase/proto/generated-go/v1b\x06proto3"
var (
file_v1_subscription_service_proto_rawDescOnce sync.Once
@@ -798,35 +752,33 @@ func file_v1_subscription_service_proto_rawDescGZIP() []byte {
}
var file_v1_subscription_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
-var file_v1_subscription_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
+var file_v1_subscription_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_v1_subscription_service_proto_goTypes = []any{
(PlanType)(0), // 0: bytebase.v1.PlanType
(PlanFeature)(0), // 1: bytebase.v1.PlanFeature
(*GetSubscriptionRequest)(nil), // 2: bytebase.v1.GetSubscriptionRequest
(*UpdateSubscriptionRequest)(nil), // 3: bytebase.v1.UpdateSubscriptionRequest
- (*PatchSubscription)(nil), // 4: bytebase.v1.PatchSubscription
- (*Subscription)(nil), // 5: bytebase.v1.Subscription
- (*PlanConfig)(nil), // 6: bytebase.v1.PlanConfig
- (*PlanLimitConfig)(nil), // 7: bytebase.v1.PlanLimitConfig
- (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp
+ (*Subscription)(nil), // 4: bytebase.v1.Subscription
+ (*PlanConfig)(nil), // 5: bytebase.v1.PlanConfig
+ (*PlanLimitConfig)(nil), // 6: bytebase.v1.PlanLimitConfig
+ (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp
}
var file_v1_subscription_service_proto_depIdxs = []int32{
- 4, // 0: bytebase.v1.UpdateSubscriptionRequest.patch:type_name -> bytebase.v1.PatchSubscription
- 8, // 1: bytebase.v1.Subscription.expires_time:type_name -> google.protobuf.Timestamp
- 0, // 2: bytebase.v1.Subscription.plan:type_name -> bytebase.v1.PlanType
- 7, // 3: bytebase.v1.PlanConfig.plans:type_name -> bytebase.v1.PlanLimitConfig
- 1, // 4: bytebase.v1.PlanConfig.instance_features:type_name -> bytebase.v1.PlanFeature
- 0, // 5: bytebase.v1.PlanLimitConfig.type:type_name -> bytebase.v1.PlanType
- 1, // 6: bytebase.v1.PlanLimitConfig.features:type_name -> bytebase.v1.PlanFeature
- 2, // 7: bytebase.v1.SubscriptionService.GetSubscription:input_type -> bytebase.v1.GetSubscriptionRequest
- 3, // 8: bytebase.v1.SubscriptionService.UpdateSubscription:input_type -> bytebase.v1.UpdateSubscriptionRequest
- 5, // 9: bytebase.v1.SubscriptionService.GetSubscription:output_type -> bytebase.v1.Subscription
- 5, // 10: bytebase.v1.SubscriptionService.UpdateSubscription:output_type -> bytebase.v1.Subscription
- 9, // [9:11] is the sub-list for method output_type
- 7, // [7:9] is the sub-list for method input_type
- 7, // [7:7] is the sub-list for extension type_name
- 7, // [7:7] is the sub-list for extension extendee
- 0, // [0:7] is the sub-list for field type_name
+ 7, // 0: bytebase.v1.Subscription.expires_time:type_name -> google.protobuf.Timestamp
+ 0, // 1: bytebase.v1.Subscription.plan:type_name -> bytebase.v1.PlanType
+ 6, // 2: bytebase.v1.PlanConfig.plans:type_name -> bytebase.v1.PlanLimitConfig
+ 1, // 3: bytebase.v1.PlanConfig.instance_features:type_name -> bytebase.v1.PlanFeature
+ 0, // 4: bytebase.v1.PlanLimitConfig.type:type_name -> bytebase.v1.PlanType
+ 1, // 5: bytebase.v1.PlanLimitConfig.features:type_name -> bytebase.v1.PlanFeature
+ 2, // 6: bytebase.v1.SubscriptionService.GetSubscription:input_type -> bytebase.v1.GetSubscriptionRequest
+ 3, // 7: bytebase.v1.SubscriptionService.UpdateSubscription:input_type -> bytebase.v1.UpdateSubscriptionRequest
+ 4, // 8: bytebase.v1.SubscriptionService.GetSubscription:output_type -> bytebase.v1.Subscription
+ 4, // 9: bytebase.v1.SubscriptionService.UpdateSubscription:output_type -> bytebase.v1.Subscription
+ 8, // [8:10] is the sub-list for method output_type
+ 6, // [6:8] is the sub-list for method input_type
+ 6, // [6:6] is the sub-list for extension type_name
+ 6, // [6:6] is the sub-list for extension extendee
+ 0, // [0:6] is the sub-list for field type_name
}
func init() { file_v1_subscription_service_proto_init() }
@@ -841,7 +793,7 @@ func file_v1_subscription_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_subscription_service_proto_rawDesc), len(file_v1_subscription_service_proto_rawDesc)),
NumEnums: 2,
- NumMessages: 6,
+ NumMessages: 5,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/generated-go/v1/subscription_service.pb.gw.go b/proto/generated-go/v1/subscription_service.pb.gw.go
index 3c473555ad..4a35b16b7b 100644
--- a/proto/generated-go/v1/subscription_service.pb.gw.go
+++ b/proto/generated-go/v1/subscription_service.pb.gw.go
@@ -59,7 +59,7 @@ func request_SubscriptionService_UpdateSubscription_0(ctx context.Context, marsh
protoReq UpdateSubscriptionRequest
metadata runtime.ServerMetadata
)
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Patch); err != nil && !errors.Is(err, io.EOF) {
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.License); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.UpdateSubscription(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@@ -71,7 +71,7 @@ func local_request_SubscriptionService_UpdateSubscription_0(ctx context.Context,
protoReq UpdateSubscriptionRequest
metadata runtime.ServerMetadata
)
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Patch); err != nil && !errors.Is(err, io.EOF) {
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.License); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.UpdateSubscription(ctx, &protoReq)
diff --git a/proto/generated-go/v1/subscription_service_grpc.pb.go b/proto/generated-go/v1/subscription_service_grpc.pb.go
index abfb0a0b6d..0256bfd870 100644
--- a/proto/generated-go/v1/subscription_service_grpc.pb.go
+++ b/proto/generated-go/v1/subscription_service_grpc.pb.go
@@ -27,6 +27,9 @@ const (
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type SubscriptionServiceClient interface {
+ // GetSubscription returns the current subscription.
+ // If there is no license, we will return a free plan subscription without expiration time.
+ // If there is expired license, we will return a free plan subscription with the expiration time of the expired license.
GetSubscription(ctx context.Context, in *GetSubscriptionRequest, opts ...grpc.CallOption) (*Subscription, error)
UpdateSubscription(ctx context.Context, in *UpdateSubscriptionRequest, opts ...grpc.CallOption) (*Subscription, error)
}
@@ -63,6 +66,9 @@ func (c *subscriptionServiceClient) UpdateSubscription(ctx context.Context, in *
// All implementations must embed UnimplementedSubscriptionServiceServer
// for forward compatibility.
type SubscriptionServiceServer interface {
+ // GetSubscription returns the current subscription.
+ // If there is no license, we will return a free plan subscription without expiration time.
+ // If there is expired license, we will return a free plan subscription with the expiration time of the expired license.
GetSubscription(context.Context, *GetSubscriptionRequest) (*Subscription, error)
UpdateSubscription(context.Context, *UpdateSubscriptionRequest) (*Subscription, error)
mustEmbedUnimplementedSubscriptionServiceServer()
diff --git a/proto/generated-go/v1/v1connect/subscription_service.connect.go b/proto/generated-go/v1/v1connect/subscription_service.connect.go
index c92b88ce59..c215d9f80c 100644
--- a/proto/generated-go/v1/v1connect/subscription_service.connect.go
+++ b/proto/generated-go/v1/v1connect/subscription_service.connect.go
@@ -43,6 +43,9 @@ const (
// SubscriptionServiceClient is a client for the bytebase.v1.SubscriptionService service.
type SubscriptionServiceClient interface {
+ // GetSubscription returns the current subscription.
+ // If there is no license, we will return a free plan subscription without expiration time.
+ // If there is expired license, we will return a free plan subscription with the expiration time of the expired license.
GetSubscription(context.Context, *connect.Request[v1.GetSubscriptionRequest]) (*connect.Response[v1.Subscription], error)
UpdateSubscription(context.Context, *connect.Request[v1.UpdateSubscriptionRequest]) (*connect.Response[v1.Subscription], error)
}
@@ -91,6 +94,9 @@ func (c *subscriptionServiceClient) UpdateSubscription(ctx context.Context, req
// SubscriptionServiceHandler is an implementation of the bytebase.v1.SubscriptionService service.
type SubscriptionServiceHandler interface {
+ // GetSubscription returns the current subscription.
+ // If there is no license, we will return a free plan subscription without expiration time.
+ // If there is expired license, we will return a free plan subscription with the expiration time of the expired license.
GetSubscription(context.Context, *connect.Request[v1.GetSubscriptionRequest]) (*connect.Response[v1.Subscription], error)
UpdateSubscription(context.Context, *connect.Request[v1.UpdateSubscriptionRequest]) (*connect.Response[v1.Subscription], error)
}
diff --git a/proto/v1/v1/subscription_service.proto b/proto/v1/v1/subscription_service.proto
index 194caea2b1..727eb8a101 100644
--- a/proto/v1/v1/subscription_service.proto
+++ b/proto/v1/v1/subscription_service.proto
@@ -11,6 +11,9 @@ import "v1/annotation.proto";
option go_package = "github.com/bytebase/bytebase/proto/generated-go/v1";
service SubscriptionService {
+ // GetSubscription returns the current subscription.
+ // If there is no license, we will return a free plan subscription without expiration time.
+ // If there is expired license, we will return a free plan subscription with the expiration time of the expired license.
rpc GetSubscription(GetSubscriptionRequest) returns (Subscription) {
option (google.api.http) = {get: "/v1/subscription"};
option (google.api.method_signature) = "";
@@ -20,7 +23,7 @@ service SubscriptionService {
rpc UpdateSubscription(UpdateSubscriptionRequest) returns (Subscription) {
option (google.api.http) = {
patch: "/v1/subscription"
- body: "patch"
+ body: "license"
};
option (google.api.method_signature) = "patch";
option (bytebase.v1.permission) = "bb.settings.set";
@@ -31,7 +34,7 @@ service SubscriptionService {
message GetSubscriptionRequest {}
message UpdateSubscriptionRequest {
- PatchSubscription patch = 1;
+ string license = 1;
}
enum PlanType {
@@ -44,10 +47,6 @@ enum PlanType {
ENTERPRISE = 3;
}
-message PatchSubscription {
- string license = 1;
-}
-
message Subscription {
int32 seat_count = 1 [(google.api.field_behavior) = OUTPUT_ONLY];