Skip to content

Commit

Permalink
chore: update subscription entity (#1162)
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy authored Jan 14, 2025
1 parent c5cdb06 commit 56f4c06
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
22 changes: 1 addition & 21 deletions libs/client-api/src/http_billing.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::Client;
use client_api_entity::billing_dto::{
SetSubscriptionRecurringInterval, SubscriptionCancelRequest, SubscriptionLinkRequest,
SubscriptionPlanDetail, SubscriptionTrialRequest, WorkspaceUsageAndLimit,
SubscriptionPlanDetail, WorkspaceUsageAndLimit,
};
use reqwest::Method;
use shared_entity::{
Expand Down Expand Up @@ -222,24 +222,4 @@ impl Client {
.await?
.into_data()
}

/// request a free trial for plan
pub async fn post_subscription_free_trial(
&self,
workspace_id: &str,
plan: SubscriptionPlan,
) -> Result<(), AppResponseError> {
let url = format!(
"{}/billing/api/v1/subscription-trial/{}",
self.base_billing_url(),
workspace_id
);
let resp = self
.cloud_client
.post(&url)
.query(&SubscriptionTrialRequest { plan })
.send()
.await?;
AppResponse::<()>::from_response(resp).await?.into_error()
}
}
3 changes: 3 additions & 0 deletions libs/shared-entity/src/dto/billing_dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,7 @@ pub struct SubscriptionLinkRequest {
#[derive(Serialize, Deserialize, Debug)]
pub struct SubscriptionTrialRequest {
pub plan: SubscriptionPlan,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub period_days: Option<u32>,
}
7 changes: 6 additions & 1 deletion services/appflowy-worker/src/import_worker/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ use std::collections::{HashMap, HashSet};
use std::env::temp_dir;
use std::fmt::Display;
use std::fs::Permissions;
use std::io::ErrorKind;
use std::ops::DerefMut;
use std::os::unix::fs::PermissionsExt;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -596,7 +597,11 @@ async fn process_task(
"[Import]: {} deleted unzip file: {:?}",
task.workspace_id, unzip_dir_path
),
Err(err) => error!("Failed to delete unzip file: {:?}", err),
Err(err) => {
if err.kind() != ErrorKind::NotFound {
error!("Failed to delete unzip file: {:?}", err);
}
},
}
});
},
Expand Down

0 comments on commit 56f4c06

Please sign in to comment.