mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
adds revision information to the share_stats endpoint (#703)
This commit is contained in:
committed by
Aiden McClelland
parent
4e2e65738f
commit
f431b79ed6
@@ -8,6 +8,7 @@ use tokio::sync::RwLock;
|
|||||||
use tracing::instrument;
|
use tracing::instrument;
|
||||||
|
|
||||||
use crate::context::RpcContext;
|
use crate::context::RpcContext;
|
||||||
|
use crate::db::util::WithRevision;
|
||||||
use crate::logs::{display_logs, fetch_logs, LogResponse, LogSource};
|
use crate::logs::{display_logs, fetch_logs, LogResponse, LogSource};
|
||||||
use crate::shutdown::Shutdown;
|
use crate::shutdown::Shutdown;
|
||||||
use crate::util::{display_none, display_serializable, IoFormat};
|
use crate::util::{display_none, display_serializable, IoFormat};
|
||||||
@@ -668,14 +669,20 @@ pub async fn config() -> Result<(), Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[command(rename = "share-stats", display(display_none))]
|
#[command(rename = "share-stats", display(display_none))]
|
||||||
async fn share_stats(#[context] ctx: RpcContext, #[arg] value: bool) -> Result<(), Error> {
|
async fn share_stats(
|
||||||
crate::db::DatabaseModel::new()
|
#[context] ctx: RpcContext,
|
||||||
|
#[arg] value: bool,
|
||||||
|
) -> Result<WithRevision<()>, Error> {
|
||||||
|
let revision = crate::db::DatabaseModel::new()
|
||||||
.server_info()
|
.server_info()
|
||||||
.share_stats()
|
.share_stats()
|
||||||
.put(&mut ctx.db.handle(), &value)
|
.put(&mut ctx.db.handle(), &value)
|
||||||
.await?;
|
.await?;
|
||||||
ctx.logger.set_sharing(value);
|
ctx.logger.set_sharing(value);
|
||||||
Ok(())
|
Ok(WithRevision {
|
||||||
|
response: (),
|
||||||
|
revision,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|||||||
Reference in New Issue
Block a user