diff options
author | metamuffin <metamuffin@disroot.org> | 2025-05-26 18:24:16 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-05-26 18:24:16 +0200 |
commit | 3b15caade07e8fbe351fed9aceb3f435bf58368e (patch) | |
tree | cce91c229b78061ad36f29d76a76d67c3c737c59 /logic/src/stats.rs | |
parent | 1eeff5c03e8985d16d4f2b6283741dd82b369bd3 (diff) | |
download | jellything-3b15caade07e8fbe351fed9aceb3f435bf58368e.tar jellything-3b15caade07e8fbe351fed9aceb3f435bf58368e.tar.bz2 jellything-3b15caade07e8fbe351fed9aceb3f435bf58368e.tar.zst |
move all direct database access to logic crate
Diffstat (limited to 'logic/src/stats.rs')
-rw-r--r-- | logic/src/stats.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/logic/src/stats.rs b/logic/src/stats.rs index 2e962e2..c7464f9 100644 --- a/logic/src/stats.rs +++ b/logic/src/stats.rs @@ -4,17 +4,16 @@ Copyright (C) 2025 metamuffin <metamuffin.org> */ -use crate::session::Session; +use crate::{DATABASE, session::Session}; use anyhow::Result; use jellycommon::{ Node, NodeKind, Visibility, api::{ApiStatsResponse, StatsBin}, }; -use jellydb::Database; use std::collections::BTreeMap; -pub fn stats(db: &Database, session: &Session) -> Result<ApiStatsResponse> { - let mut items = db.list_nodes_with_udata(session.user.name.as_str())?; +pub fn stats(session: &Session) -> Result<ApiStatsResponse> { + let mut items = DATABASE.list_nodes_with_udata(session.user.name.as_str())?; items.retain(|(n, _)| n.visibility >= Visibility::Reduced); trait BinExt { |