admin/settings: maintenance page, show database size

This commit is contained in:
Philippe Loctaux 2023-05-06 16:11:16 +02:00
parent 3dfcd542bf
commit ff6c910b2f
13 changed files with 203 additions and 0 deletions

View file

@ -9,3 +9,4 @@ id = { path = "../id" }
thiserror = { workspace = true }
chrono = { workspace = true }
url = { workspace = true }
human_bytes = { version = "0.4.1", default-features = false }

View file

@ -2,6 +2,7 @@ use crate::error::Error;
use crate::Settings;
use database::sqlx::SqliteExecutor;
use database::Settings as DatabaseSettings;
use human_bytes::human_bytes;
use id::UserID;
use url::Url;
@ -34,6 +35,12 @@ impl Settings {
Ok(DatabaseSettings::get(conn).await.map(Self::from)?)
}
pub async fn database_size(conn: impl SqliteExecutor<'_>) -> Result<Option<String>, Error> {
Ok(DatabaseSettings::database_size(conn)
.await?
.map(human_bytes))
}
pub async fn set_business_name(
conn: impl SqliteExecutor<'_>,
business_name: &str,