summaryrefslogtreecommitdiff
path: root/src/setup/app.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-10-27 18:15:25 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-10-28 01:43:26 -0400
commitd66728889105f6f1ef5113d9ceb223e362df0008 (patch)
tree5102813fbaa222276dcabd15a736838f9641d71f /src/setup/app.rs
parentc2a3a010c67776b9a459d7ba0930630ff25a3a51 (diff)
Convert the `Setup` component into a freestanding struct.
The changes to the setup-requiring middleware are probably more general than was strictly needed, but they will make it work with anything that can provide a `Setup` component rather than being bolted to `App` specifically, which feels tidier.
Diffstat (limited to 'src/setup/app.rs')
-rw-r--r--src/setup/app.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/setup/app.rs b/src/setup/app.rs
index 2a8ec30..9539406 100644
--- a/src/setup/app.rs
+++ b/src/setup/app.rs
@@ -10,13 +10,14 @@ use crate::{
user::create::{self, Create},
};
-pub struct Setup<'a> {
- db: &'a SqlitePool,
- events: &'a Broadcaster,
+#[derive(Clone)]
+pub struct Setup {
+ db: SqlitePool,
+ events: Broadcaster,
}
-impl<'a> Setup<'a> {
- pub const fn new(db: &'a SqlitePool, events: &'a Broadcaster) -> Self {
+impl Setup {
+ pub const fn new(db: SqlitePool, events: Broadcaster) -> Self {
Self { db, events }
}
@@ -41,7 +42,7 @@ impl<'a> Setup<'a> {
tx.tokens().create(&token, &secret).await?;
tx.commit().await?;
- stored.publish(self.events);
+ stored.publish(&self.events);
Ok(secret)
}