diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock index 16cedb558c..f726359968 100644 --- a/frontend/rust-lib/Cargo.lock +++ b/frontend/rust-lib/Cargo.lock @@ -163,7 +163,7 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "app-error" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=a2f92bb#a2f92bb13e7c3d33783359d02235ba4a5058a32f" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4d9108643b6b39b557f594a031f4fa20e9125ec8#4d9108643b6b39b557f594a031f4fa20e9125ec8" dependencies = [ "anyhow", "bincode", @@ -183,7 +183,7 @@ dependencies = [ [[package]] name = "appflowy-ai-client" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=a2f92bb#a2f92bb13e7c3d33783359d02235ba4a5058a32f" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4d9108643b6b39b557f594a031f4fa20e9125ec8#4d9108643b6b39b557f594a031f4fa20e9125ec8" dependencies = [ "anyhow", "bytes", @@ -698,7 +698,7 @@ dependencies = [ [[package]] name = "client-api" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=a2f92bb#a2f92bb13e7c3d33783359d02235ba4a5058a32f" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4d9108643b6b39b557f594a031f4fa20e9125ec8#4d9108643b6b39b557f594a031f4fa20e9125ec8" dependencies = [ "again", "anyhow", @@ -719,6 +719,7 @@ dependencies = [ "getrandom 0.2.10", "gotrue", "infra", + "lazy_static", "mime", "parking_lot 0.12.1", "percent-encoding", @@ -747,7 +748,7 @@ dependencies = [ [[package]] name = "client-api-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=a2f92bb#a2f92bb13e7c3d33783359d02235ba4a5058a32f" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4d9108643b6b39b557f594a031f4fa20e9125ec8#4d9108643b6b39b557f594a031f4fa20e9125ec8" dependencies = [ "collab-entity", "collab-rt-entity", @@ -759,7 +760,7 @@ dependencies = [ [[package]] name = "client-websocket" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=a2f92bb#a2f92bb13e7c3d33783359d02235ba4a5058a32f" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4d9108643b6b39b557f594a031f4fa20e9125ec8#4d9108643b6b39b557f594a031f4fa20e9125ec8" dependencies = [ "futures-channel", "futures-util", @@ -968,7 +969,7 @@ dependencies = [ [[package]] name = "collab-rt-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=a2f92bb#a2f92bb13e7c3d33783359d02235ba4a5058a32f" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4d9108643b6b39b557f594a031f4fa20e9125ec8#4d9108643b6b39b557f594a031f4fa20e9125ec8" dependencies = [ "anyhow", "bincode", @@ -993,7 +994,7 @@ dependencies = [ [[package]] name = "collab-rt-protocol" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=a2f92bb#a2f92bb13e7c3d33783359d02235ba4a5058a32f" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4d9108643b6b39b557f594a031f4fa20e9125ec8#4d9108643b6b39b557f594a031f4fa20e9125ec8" dependencies = [ "anyhow", "async-trait", @@ -1310,7 +1311,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" [[package]] name = "database-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=a2f92bb#a2f92bb13e7c3d33783359d02235ba4a5058a32f" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4d9108643b6b39b557f594a031f4fa20e9125ec8#4d9108643b6b39b557f594a031f4fa20e9125ec8" dependencies = [ "anyhow", "app-error", @@ -2616,7 +2617,7 @@ dependencies = [ [[package]] name = "gotrue" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=a2f92bb#a2f92bb13e7c3d33783359d02235ba4a5058a32f" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4d9108643b6b39b557f594a031f4fa20e9125ec8#4d9108643b6b39b557f594a031f4fa20e9125ec8" dependencies = [ "anyhow", "futures-util", @@ -2633,7 +2634,7 @@ dependencies = [ [[package]] name = "gotrue-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=a2f92bb#a2f92bb13e7c3d33783359d02235ba4a5058a32f" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4d9108643b6b39b557f594a031f4fa20e9125ec8#4d9108643b6b39b557f594a031f4fa20e9125ec8" dependencies = [ "anyhow", "app-error", @@ -2998,7 +2999,7 @@ dependencies = [ [[package]] name = "infra" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=a2f92bb#a2f92bb13e7c3d33783359d02235ba4a5058a32f" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4d9108643b6b39b557f594a031f4fa20e9125ec8#4d9108643b6b39b557f594a031f4fa20e9125ec8" dependencies = [ "anyhow", "bytes", @@ -5099,7 +5100,7 @@ dependencies = [ [[package]] name = "shared-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=a2f92bb#a2f92bb13e7c3d33783359d02235ba4a5058a32f" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4d9108643b6b39b557f594a031f4fa20e9125ec8#4d9108643b6b39b557f594a031f4fa20e9125ec8" dependencies = [ "anyhow", "app-error", diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml index 5dbacba4ff..2833e1e7f7 100644 --- a/frontend/rust-lib/Cargo.toml +++ b/frontend/rust-lib/Cargo.toml @@ -97,8 +97,8 @@ validator = { version = "0.16.1", features = ["derive"] } # Run the script.add_workspace_members: # scripts/tool/update_client_api_rev.sh new_rev_id # ⚠️⚠️⚠️️ -client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "a2f92bb" } -client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "a2f92bb" } +client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "4d9108643b6b39b557f594a031f4fa20e9125ec8" } +client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "4d9108643b6b39b557f594a031f4fa20e9125ec8" } [profile.dev] opt-level = 1 diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs index 75922232ec..f29dc52934 100644 --- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs +++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use anyhow::anyhow; use client_api::entity::billing_dto::{ - SubscriptionPlan, SubscriptionStatus, WorkspaceSubscriptionPlan, WorkspaceSubscriptionStatus, + SubscriptionPlan, SubscriptionStatus, WorkspaceSubscriptionStatus, }; use client_api::entity::workspace_dto::{ CreateWorkspaceParam, PatchWorkspaceParam, WorkspaceMemberChangeset, WorkspaceMemberInvitation, @@ -543,7 +543,7 @@ where let try_get_client = self.server.try_get_client(); FutureResult::new(async move { let client = try_get_client?; - client.cancel_subscription(&workspace_id).await?; + client.cancel_subscription(&workspace_id, &SubscriptionPlan::Pro).await?; // TODO: Ok(()) }) } @@ -552,12 +552,12 @@ where let try_get_client = self.server.try_get_client(); FutureResult::new(async move { let client = try_get_client?; - let usage = client.get_billing_workspace_usage(&workspace_id).await?; + let usage = client.get_workspace_usage_and_limit(&workspace_id).await?; Ok(WorkspaceUsage { - member_count: usage.member_count, - member_count_limit: usage.member_count_limit, - total_blob_bytes: usage.total_blob_bytes, - total_blob_bytes_limit: usage.total_blob_bytes_limit, + member_count: usage.member_count as usize, + member_count_limit: usage.member_count_limit as usize, + total_blob_bytes: usage.storage_bytes as usize, + total_blob_bytes_limit: usage.storage_bytes_limit as usize, }) }) } @@ -726,8 +726,8 @@ fn to_workspace_subscription(s: WorkspaceSubscriptionStatus) -> WorkspaceSubscri WorkspaceSubscription { workspace_id: s.workspace_id, subscription_plan: match s.workspace_plan { - WorkspaceSubscriptionPlan::Pro => flowy_user_pub::entities::SubscriptionPlan::Pro, - WorkspaceSubscriptionPlan::Team => flowy_user_pub::entities::SubscriptionPlan::Team, + // WorkspaceSubscriptionPlan::Pro => flowy_user_pub::entities::SubscriptionPlan::Pro, + // WorkspaceSubscriptionPlan::Team => flowy_user_pub::entities::SubscriptionPlan::Team, _ => flowy_user_pub::entities::SubscriptionPlan::None, }, recurring_interval: match s.recurring_interval { @@ -739,6 +739,6 @@ fn to_workspace_subscription(s: WorkspaceSubscriptionStatus) -> WorkspaceSubscri }, }, is_active: matches!(s.subscription_status, SubscriptionStatus::Active), - canceled_at: s.canceled_at, + canceled_at: s.cancel_at, } }