This commit is contained in:
Mateusz Gruszczyński
2026-07-20 20:27:05 +02:00
parent 48c92dc382
commit 15ee0ad993
22 changed files with 377 additions and 188 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
use std::{collections::HashMap, sync::Arc};
use sqlx::SqlitePool;
use crate::database::Database;
use tokio::sync::{broadcast, RwLock};
const CHANNEL_CAPACITY: usize = 256;
@@ -15,7 +15,7 @@ pub struct NoteUpdate {
#[derive(Debug)]
pub struct AppState {
pub db: SqlitePool,
pub db: Database,
pub asset_version: String,
pub files_dir: String,
pub upload_max_size_bytes: usize,
@@ -23,7 +23,7 @@ pub struct AppState {
}
impl AppState {
pub fn new(db: SqlitePool, asset_version: String, files_dir: String, upload_max_size_bytes: usize) -> Self {
pub fn new(db: Database, asset_version: String, files_dir: String, upload_max_size_bytes: usize) -> Self {
Self { db, asset_version, files_dir, upload_max_size_bytes, channels: RwLock::new(HashMap::new()) }
}
async fn channel_for_key(&self, key: String) -> broadcast::Sender<NoteUpdate> {