summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/channel/app.rs10
-rw-r--r--src/index/app.rs8
-rw-r--r--src/index/routes.rs2
3 files changed, 10 insertions, 10 deletions
diff --git a/src/channel/app.rs b/src/channel/app.rs
index 5417a5e..36fa552 100644
--- a/src/channel/app.rs
+++ b/src/channel/app.rs
@@ -11,7 +11,7 @@ use tokio::sync::broadcast::{channel, Sender};
use tokio_stream::wrappers::BroadcastStream;
use super::repo::{
- channels::{Id as ChannelId, Provider as _},
+ channels::{Channel, Id as ChannelId, Provider as _},
messages::{BroadcastMessage, Provider as _},
};
use crate::{clock::DateTime, error::BoxedError, login::repo::logins::Login};
@@ -35,6 +35,14 @@ impl<'a> Channels<'a> {
Ok(())
}
+ pub async fn all(&self) -> Result<Vec<Channel>, BoxedError> {
+ let mut tx = self.db.begin().await?;
+ let channels = tx.channels().all().await?;
+ tx.commit().await?;
+
+ Ok(channels)
+ }
+
pub async fn send(
&self,
login: &Login,
diff --git a/src/index/app.rs b/src/index/app.rs
index b315b45..fabf35c 100644
--- a/src/index/app.rs
+++ b/src/index/app.rs
@@ -14,14 +14,6 @@ impl<'a> Index<'a> {
Self { db }
}
- pub async fn for_authenticated(&self) -> Result<Vec<Channel>, BoxedError> {
- let mut tx = self.db.begin().await?;
- let channels = tx.channels().all().await?;
- tx.commit().await?;
-
- Ok(channels)
- }
-
pub async fn channel(&self, channel: ChannelId) -> Result<Channel, BoxedError> {
let mut tx = self.db.begin().await?;
let channel = tx.channels().by_id(channel).await?;
diff --git a/src/index/routes.rs b/src/index/routes.rs
index 07b6001..2d77e5b 100644
--- a/src/index/routes.rs
+++ b/src/index/routes.rs
@@ -21,7 +21,7 @@ async fn index(State(app): State<App>, login: Option<Login>) -> Result<Markup, I
}
async fn index_authenticated(app: App, login: Login) -> Result<Markup, InternalError> {
- let channels = app.index().for_authenticated().await?;
+ let channels = app.channels().all().await?;
Ok(templates::authenticated(login, &channels))
}