diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2025-12-12 10:23:59 -0500 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2025-12-17 15:48:20 -0500 |
| commit | 98ce341c5fe8403b9dc5654fe18e1ebba61e68e4 (patch) | |
| tree | 88acdfafe32ad0f99effaaa89cc7d98db2141fda /src/push/repo.rs | |
| parent | 522c1533a0af7af7d96bb4d6850ce0b2c8762e89 (diff) | |
Diffstat (limited to 'src/push/repo.rs')
| -rw-r--r-- | src/push/repo.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/push/repo.rs b/src/push/repo.rs index 4183489..8850059 100644 --- a/src/push/repo.rs +++ b/src/push/repo.rs @@ -83,6 +83,27 @@ impl Push<'_> { Ok(info) } + pub async fn broadcast_from( + &mut self, + originator: &Login, + ) -> Result<Vec<SubscriptionInfo>, sqlx::Error> { + sqlx::query!( + r#" + select + sub.endpoint, + sub.p256dh, + sub.auth + from push_subscription as sub + join token on sub.token = token.id + where token.login <> $1 + "#, + originator.id, + ) + .map(|row| SubscriptionInfo::new(row.endpoint, row.p256dh, row.auth)) + .fetch_all(&mut *self.0) + .await + } + pub async fn unsubscribe( &mut self, subscription: &SubscriptionInfo, |
