Minor cleanup

This commit is contained in:
StNicolay 2023-06-11 15:58:41 +03:00
parent 8ee9acc12b
commit fba2bb0b86
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D
2 changed files with 3 additions and 5 deletions

View File

@ -8,7 +8,6 @@ use entity::prelude::*;
use futures::TryStreamExt;
use parking_lot::Mutex;
use sea_orm::DatabaseConnection;
use serde_json::to_vec_pretty;
use std::sync::Arc;
use teloxide::{adaptors::Throttle, prelude::*, types::InputFile};
use tokio::task::spawn_blocking;
@ -52,7 +51,7 @@ async fn get_master_pass(
accounts.sort_unstable_by(|this, other| this.name.cmp(&other.name));
let json = to_vec_pretty(&User { accounts })?;
let json = serde_json::to_vec_pretty(&User { accounts })?;
let file = InputFile::memory(json).file_name("accounts.json");
bot.send_document(msg.chat.id, file)
@ -69,9 +68,7 @@ pub async fn export(bot: Throttle<Bot>, msg: Message, dialogue: MainDialogue) ->
.await?;
dialogue
.update(State::GetMasterPass(Handler::new(
move |bot, msg, db, dialogue, master_pass| {
get_master_pass(bot, msg, db, dialogue, master_pass)
},
get_master_pass,
previous,
)))
.await?;

View File

@ -52,6 +52,7 @@ impl DecryptedAccount {
}
#[derive(Serialize, Deserialize)]
#[repr(transparent)]
pub struct User {
pub accounts: Vec<DecryptedAccount>,
}