diff --git a/web3_proxy/src/bin/web3_proxy_cli/count_users.rs b/web3_proxy/src/bin/web3_proxy_cli/count_users.rs new file mode 100644 index 00000000..ee309116 --- /dev/null +++ b/web3_proxy/src/bin/web3_proxy_cli/count_users.rs @@ -0,0 +1,19 @@ +use argh::FromArgs; +use entities::user; +use log::info; +use migration::sea_orm::{self, EntityTrait, PaginatorTrait}; + +#[derive(FromArgs, PartialEq, Debug, Eq)] +/// Create a new user and api key +#[argh(subcommand, name = "count_users")] +pub struct CountUsersSubCommand {} + +impl CountUsersSubCommand { + pub async fn main(self, db: &sea_orm::DatabaseConnection) -> anyhow::Result<()> { + let count = user::Entity::find().count(db).await?; + + info!("user count: {}", count); + + Ok(()) + } +}