missed a git add

This commit is contained in:
Bryan Stitt 2023-01-02 17:24:49 -08:00
parent 80dfe8b7f2
commit 8ccb2e6c46

View File

@ -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(())
}
}