aboutsummaryrefslogtreecommitdiff
path: root/logic
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-04-30 11:46:28 +0200
committermetamuffin <metamuffin@disroot.org>2025-04-30 11:46:28 +0200
commit35ae80f183904466667af73c7921b4ade399569a (patch)
tree3a7eec95debbd9ba292436ff989742b8a9b1dff4 /logic
parentd6a039a10ac3c81d410beb9b648d29524ca1e278 (diff)
downloadjellything-35ae80f183904466667af73c7921b4ade399569a.tar
jellything-35ae80f183904466667af73c7921b4ade399569a.tar.bz2
jellything-35ae80f183904466667af73c7921b4ade399569a.tar.zst
split base into asset_token and db
Diffstat (limited to 'logic')
-rw-r--r--logic/Cargo.toml3
-rw-r--r--logic/src/admin/user.rs2
-rw-r--r--logic/src/home.rs2
-rw-r--r--logic/src/items.rs2
-rw-r--r--logic/src/lib.rs2
-rw-r--r--logic/src/login.rs2
-rw-r--r--logic/src/node.rs2
-rw-r--r--logic/src/search.rs2
-rw-r--r--logic/src/stats.rs3
9 files changed, 11 insertions, 9 deletions
diff --git a/logic/Cargo.toml b/logic/Cargo.toml
index ec5ee2b..23016f9 100644
--- a/logic/Cargo.toml
+++ b/logic/Cargo.toml
@@ -4,8 +4,9 @@ version = "0.1.0"
edition = "2024"
[dependencies]
-jellybase = { path = "../base" }
+jellyimport-asset-token = { path = "../import/asset_token" }
jellycommon = { path = "../common" }
+jellydb = { path = "../database" }
log = "0.4.27"
anyhow = "1.0.98"
base64 = "0.22.1"
diff --git a/logic/src/admin/user.rs b/logic/src/admin/user.rs
index 2d788cb..3ec3852 100644
--- a/logic/src/admin/user.rs
+++ b/logic/src/admin/user.rs
@@ -6,8 +6,8 @@
use crate::session::AdminSession;
use anyhow::Result;
-use jellybase::database::Database;
use jellycommon::api::ApiAdminUsersResponse;
+use jellydb::Database;
pub fn admin_users(db: &Database, _session: &AdminSession) -> Result<ApiAdminUsersResponse> {
// TODO dont return useless info like passwords
diff --git a/logic/src/home.rs b/logic/src/home.rs
index b774a9f..ad3fee5 100644
--- a/logic/src/home.rs
+++ b/logic/src/home.rs
@@ -6,13 +6,13 @@
use crate::{node::DatabaseNodeUserDataExt, session::Session};
use anyhow::{Context, Result};
-use jellybase::database::Database;
use jellycommon::{
NodeID, NodeKind, Rating, Visibility,
api::ApiHomeResponse,
chrono::{Datelike, Utc},
user::WatchedState,
};
+use jellydb::Database;
pub fn home(db: &Database, session: &Session) -> Result<ApiHomeResponse> {
let mut items = db.list_nodes_with_udata(&session.user.name)?;
diff --git a/logic/src/items.rs b/logic/src/items.rs
index 67c45cb..99fb767 100644
--- a/logic/src/items.rs
+++ b/logic/src/items.rs
@@ -6,11 +6,11 @@
use crate::{filter_sort::filter_and_sort_nodes, session::Session};
use anyhow::Result;
-use jellybase::database::Database;
use jellycommon::{
Visibility,
api::{ApiItemsResponse, NodeFilterSort, SortOrder, SortProperty},
};
+use jellydb::Database;
pub fn all_items(
db: &Database,
diff --git a/logic/src/lib.rs b/logic/src/lib.rs
index 64656f5..79d27d9 100644
--- a/logic/src/lib.rs
+++ b/logic/src/lib.rs
@@ -15,6 +15,8 @@ pub mod search;
pub mod session;
pub mod stats;
+pub use jellydb::Database;
+
use serde::{Deserialize, Serialize};
use std::sync::LazyLock;
use std::sync::Mutex;
diff --git a/logic/src/login.rs b/logic/src/login.rs
index 26a6b7f..72a5903 100644
--- a/logic/src/login.rs
+++ b/logic/src/login.rs
@@ -6,8 +6,8 @@
use crate::{CONF, session::create};
use anyhow::{Result, anyhow};
use argon2::{Argon2, PasswordHasher, password_hash::Salt};
-use jellybase::database::Database;
use jellycommon::user::UserPermission;
+use jellydb::Database;
use log::info;
use std::{collections::HashSet, time::Duration};
diff --git a/logic/src/node.rs b/logic/src/node.rs
index 8a53bec..c8ff820 100644
--- a/logic/src/node.rs
+++ b/logic/src/node.rs
@@ -5,12 +5,12 @@
*/
use crate::{filter_sort::filter_and_sort_nodes, session::Session};
use anyhow::{Result, anyhow};
-use jellybase::database::Database;
use jellycommon::{
Node, NodeID, NodeKind, Visibility,
api::{ApiNodeResponse, NodeFilterSort, SortOrder, SortProperty},
user::NodeUserData,
};
+use jellydb::Database;
use std::{cmp::Reverse, collections::BTreeMap, sync::Arc};
pub fn get_node(
diff --git a/logic/src/search.rs b/logic/src/search.rs
index 8e41e27..68975f1 100644
--- a/logic/src/search.rs
+++ b/logic/src/search.rs
@@ -5,8 +5,8 @@
*/
use crate::{node::DatabaseNodeUserDataExt, session::Session};
use anyhow::Result;
-use jellybase::database::Database;
use jellycommon::{Visibility, api::ApiSearchResponse};
+use jellydb::Database;
use std::time::Instant;
pub fn search(
diff --git a/logic/src/stats.rs b/logic/src/stats.rs
index 2569180..2e962e2 100644
--- a/logic/src/stats.rs
+++ b/logic/src/stats.rs
@@ -6,11 +6,11 @@
use crate::session::Session;
use anyhow::Result;
-use jellybase::database::Database;
use jellycommon::{
Node, NodeKind, Visibility,
api::{ApiStatsResponse, StatsBin},
};
+use jellydb::Database;
use std::collections::BTreeMap;
pub fn stats(db: &Database, session: &Session) -> Result<ApiStatsResponse> {
@@ -34,7 +34,6 @@ pub fn stats(db: &Database, session: &Session) -> Result<ApiStatsResponse> {
}
}
}
-
}
let mut total = StatsBin::default();