mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-07-02 12:35:33 +00:00
refactor(database)!: decouple SQLs from backend logic and cache stmts
This decouples SQLs from handler logic, makes it easier for auditing and caching. It also enables the possibility to switch or support multiple database backends.
This commit is contained in:
parent
b955d32099
commit
fafd2de2e3
11 changed files with 769 additions and 669 deletions
|
@ -20,7 +20,7 @@ use tokio::sync::broadcast;
|
|||
use tokio_stream::wrappers::errors::BroadcastStreamRecvError;
|
||||
use tokio_stream::wrappers::BroadcastStream;
|
||||
|
||||
use crate::database::ConnectionExt;
|
||||
use crate::database::TransactionOps;
|
||||
use crate::AppState;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
@ -145,8 +145,7 @@ pub async fn handle_ws(st: Arc<AppState>, ws: &mut WebSocket) -> Result<Infallib
|
|||
|
||||
let (uid, _) = st
|
||||
.db
|
||||
.get()
|
||||
.get_user(&auth.signee.user)
|
||||
.with_read(|txn| txn.get_user(&auth.signee.user))
|
||||
.map_err(|err| anyhow!("{}", err.message))?;
|
||||
// FIXME: Consistency of id's sign.
|
||||
uid as u64
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue