summaryrefslogtreecommitdiff
path: root/src/app.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-10-28 14:41:50 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-10-28 14:41:50 -0400
commit4a91792e023a5877f8ac9b8a352e99c4486d698f (patch)
tree0b0e5466d0945a5f853e98eb8d0b0215e67ed3fb /src/app.rs
parent9c271b27ff03cf4976326090ff54e3b5dfc04962 (diff)
parent0ef69c7d256380e660edc45ace7f1d6151226340 (diff)
Merge remote-tracking branch 'codeberg/main' into push-notify
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs79
1 files changed, 61 insertions, 18 deletions
diff --git a/src/app.rs b/src/app.rs
index 0f3f6ad..8f16e02 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -1,3 +1,4 @@
+use axum::extract::FromRef;
use sqlx::sqlite::SqlitePool;
#[cfg(test)]
@@ -34,41 +35,83 @@ impl App {
}
impl App {
- pub const fn boot(&self) -> Boot<'_> {
- Boot::new(&self.db)
+ pub fn boot(&self) -> Boot {
+ Boot::new(self.db.clone())
}
- pub const fn conversations(&self) -> Conversations<'_> {
- Conversations::new(&self.db, &self.events)
+ pub fn conversations(&self) -> Conversations {
+ Conversations::new(self.db.clone(), self.events.clone())
}
- pub const fn events(&self) -> Events<'_> {
- Events::new(&self.db, &self.events)
+ pub fn events(&self) -> Events {
+ Events::new(self.db.clone(), self.events.clone())
}
- pub const fn invites(&self) -> Invites<'_> {
- Invites::new(&self.db, &self.events)
+ pub fn invites(&self) -> Invites {
+ Invites::new(self.db.clone(), self.events.clone())
}
- pub const fn logins(&self) -> Logins<'_> {
- Logins::new(&self.db, &self.token_events)
+ pub fn logins(&self) -> Logins {
+ Logins::new(self.db.clone(), self.token_events.clone())
}
- pub const fn messages(&self) -> Messages<'_> {
- Messages::new(&self.db, &self.events)
+ pub fn messages(&self) -> Messages {
+ Messages::new(self.db.clone(), self.events.clone())
}
- pub const fn setup(&self) -> Setup<'_> {
- Setup::new(&self.db, &self.events)
+ pub fn setup(&self) -> Setup {
+ Setup::new(self.db.clone(), self.events.clone())
}
- pub const fn tokens(&self) -> Tokens<'_> {
- Tokens::new(&self.db, &self.token_events)
+ pub fn tokens(&self) -> Tokens {
+ Tokens::new(self.db.clone(), self.token_events.clone())
}
#[cfg(test)]
- pub const fn users(&self) -> Users<'_> {
- Users::new(&self.db, &self.events)
+ pub fn users(&self) -> Users {
+ Users::new(self.db.clone(), self.events.clone())
+ }
+}
+
+impl FromRef<App> for Boot {
+ fn from_ref(app: &App) -> Self {
+ app.boot()
+ }
+}
+
+impl FromRef<App> for Conversations {
+ fn from_ref(app: &App) -> Self {
+ app.conversations()
+ }
+}
+
+impl FromRef<App> for Invites {
+ fn from_ref(app: &App) -> Self {
+ app.invites()
+ }
+}
+
+impl FromRef<App> for Logins {
+ fn from_ref(app: &App) -> Self {
+ app.logins()
+ }
+}
+
+impl FromRef<App> for Messages {
+ fn from_ref(app: &App) -> Self {
+ app.messages()
+ }
+}
+
+impl FromRef<App> for Setup {
+ fn from_ref(app: &App) -> Self {
+ app.setup()
+ }
+}
+
+impl FromRef<App> for Tokens {
+ fn from_ref(app: &App) -> Self {
+ app.tokens()
}
pub const fn vapid(&self) -> Vapid<'_> {