diff --git a/src/db/general.rs b/src/db/general.rs index 3830803..2d29afb 100644 --- a/src/db/general.rs +++ b/src/db/general.rs @@ -180,7 +180,7 @@ pub struct Ban { } impl Ban { - pub async fn get_record_by_wallets( + pub async fn get_record( db: &Surreal, op_wallet: &str, user_wallet: &str, @@ -196,12 +196,12 @@ impl Ban { Ok(ban_record) } - pub async fn ban_a_user( + pub async fn create( db: &Surreal, op_wallet: &str, user_wallet: &str, ) -> Result<(), Error> { - if Self::get_record_by_wallets(db, op_wallet, user_wallet).await?.is_some() { + if Self::get_record(db, op_wallet, user_wallet).await?.is_some() { log::error!("User {user_wallet} is already banned by {op_wallet}"); return Err(Error::AlreadyBanned(op_wallet.to_string())); } diff --git a/src/grpc/general.rs b/src/grpc/general.rs index 667908b..38e7bcc 100644 --- a/src/grpc/general.rs +++ b/src/grpc/general.rs @@ -155,7 +155,7 @@ impl BrainGeneralCli for GeneralCliServer { async fn ban_user(&self, req: Request) -> Result, Status> { let req = check_sig_from_req(req)?; log::info!("Banning user: {}, by: {}", req.user_wallet, req.operator_wallet); - db::Ban::ban_a_user(&self.db, &req.operator_wallet, &req.user_wallet).await?; + db::Ban::create(&self.db, &req.operator_wallet, &req.user_wallet).await?; Ok(Response::new(Empty {})) }