add all admin query command for appservices

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-04-22 18:53:40 -04:00 committed by June
parent d90ac11603
commit 906057dd8d
2 changed files with 17 additions and 1 deletions

View file

@ -13,7 +13,20 @@ pub(super) async fn appservice(subcommand: Appservice) -> Result<RoomMessageEven
let results = services()
.appservice
.db
.get_registration(appservice_id.as_ref())?;
.get_registration(appservice_id.as_ref());
let query_time = timer.elapsed();
Ok(RoomMessageEventContent::text_html(
format!("Query completed in {query_time:?}:\n\n```\n{:?}```", results),
format!(
"<p>Query completed in {query_time:?}:</p>\n<pre><code>{:?}\n</code></pre>",
results
),
))
},
Appservice::All => {
let timer = tokio::time::Instant::now();
let results = services().appservice.db.all();
let query_time = timer.elapsed();
Ok(RoomMessageEventContent::text_html(

View file

@ -85,6 +85,9 @@ pub(crate) enum Appservice {
/// Appservice registration ID
appservice_id: Box<str>,
},
/// - Gets all appservice registrations with their ID and registration info
All,
}
#[cfg_attr(test, derive(Debug))]