feat(core): add raw db statisics endpoint for admin panel

This commit is contained in:
Paul Makles
2023-03-04 11:18:05 +00:00
parent ce77e926a5
commit 6bd8221eda
10 changed files with 249 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ mod push;
mod root;
mod safety;
mod servers;
mod stats;
mod sync;
mod users;
@@ -21,7 +22,7 @@ pub fn mount(mut rocket: Rocket<Build>) -> Rocket<Build> {
mount_endpoints_and_merged_docs! {
rocket, "/".to_owned(), settings,
"/" => (vec![], custom_openapi_spec()),
"" => openapi_get_routes_spec![root::root, root::ping],
"" => openapi_get_routes_spec![root::root, stats::stats, root::ping],
"/users" => users::routes(),
"/bots" => bots::routes(),
"/channels" => channels::routes(),

View File

@@ -0,0 +1,13 @@
use revolt_quark::models::stats::Stats;
use revolt_quark::{Db, Result};
use rocket::serde::json::Json;
/// # Query Stats
///
/// Fetch various technical statistics.
#[openapi(tag = "Core")]
#[get("/stats")]
pub async fn stats(db: &Db) -> Result<Json<Stats>> {
Ok(Json(db.generate_stats().await?))
}