From 3b15caade07e8fbe351fed9aceb3f435bf58368e Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 26 May 2025 18:24:16 +0200 Subject: move all direct database access to logic crate --- logic/src/stats.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'logic/src/stats.rs') 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 */ -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 { - let mut items = db.list_nodes_with_udata(session.user.name.as_str())?; +pub fn stats(session: &Session) -> Result { + let mut items = DATABASE.list_nodes_with_udata(session.user.name.as_str())?; items.retain(|(n, _)| n.visibility >= Visibility::Reduced); trait BinExt { -- cgit v1.2.3-70-g09d2