mirror of
https://github.com/chatmail/core.git
synced 2026-05-06 06:46:35 +03:00
jsonrpc: add api migrate_account and get_blob_dir (#5584)
closes #5533 adds the functions that were still missing for migration to jsonrpc (the ones that the cffi already had, so just should be quick to review ;)
This commit is contained in:
@@ -185,6 +185,16 @@ impl CommandApi {
|
|||||||
self.accounts.write().await.add_account().await
|
self.accounts.write().await.add_account().await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Imports/migrated an existing account from a database path into this account manager.
|
||||||
|
/// Returns the ID of new account.
|
||||||
|
async fn migrate_account(&self, path_to_db: String) -> Result<u32> {
|
||||||
|
self.accounts
|
||||||
|
.write()
|
||||||
|
.await
|
||||||
|
.migrate_account(std::path::PathBuf::from(path_to_db))
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
async fn remove_account(&self, account_id: u32) -> Result<()> {
|
async fn remove_account(&self, account_id: u32) -> Result<()> {
|
||||||
self.accounts
|
self.accounts
|
||||||
.write()
|
.write()
|
||||||
@@ -329,6 +339,11 @@ impl CommandApi {
|
|||||||
ctx.get_info().await
|
ctx.get_info().await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn get_blob_dir(&self, account_id: u32) -> Result<Option<String>> {
|
||||||
|
let ctx = self.get_context(account_id).await?;
|
||||||
|
Ok(ctx.get_blobdir().to_str().map(|s| s.to_owned()))
|
||||||
|
}
|
||||||
|
|
||||||
async fn draft_self_report(&self, account_id: u32) -> Result<u32> {
|
async fn draft_self_report(&self, account_id: u32) -> Result<u32> {
|
||||||
let ctx = self.get_context(account_id).await?;
|
let ctx = self.get_context(account_id).await?;
|
||||||
Ok(ctx.draft_self_report().await?.to_u32())
|
Ok(ctx.draft_self_report().await?.to_u32())
|
||||||
|
|||||||
Reference in New Issue
Block a user