feat: Chat request implementation #14

Manually merged
awiteb merged 55 commits from awiteb/chat-request-and-response into master 2024-07-18 14:21:39 +02:00 AGit
Showing only changes of commit 65d6b147d9 - Show all commits

View file

@ -31,7 +31,7 @@ use crate::{
/// Extension trait for the Depot. /// Extension trait for the Depot.
pub trait DepotExt { pub trait DepotExt {
/// Returns the database connection /// Returns the database connection
fn db_conn(&self) -> &DatabaseConnection; fn db_conn(&self) -> Arc<DatabaseConnection>;
/// Returns the server configuration /// Returns the server configuration
fn config(&self) -> &Config; fn config(&self) -> &Config;
/// Retutns the nonce cache /// Retutns the nonce cache
@ -57,9 +57,11 @@ pub trait OnlineUsersExt {
} }
impl DepotExt for Depot { impl DepotExt for Depot {
fn db_conn(&self) -> &DatabaseConnection { fn db_conn(&self) -> Arc<DatabaseConnection> {
Arc::clone(
self.obtain::<Arc<DatabaseConnection>>() self.obtain::<Arc<DatabaseConnection>>()
.expect("Database connection not found") .expect("Database connection not found"),
)
} }
fn config(&self) -> &Config { fn config(&self) -> &Config {