From 6a10fcaf64938da52b326ea80013d9f30ed62a6c Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Sat, 5 Oct 2024 22:42:43 -0400 Subject: Separate `/api/boot` into its own module. --- src/channel/app.rs | 48 +----------------------------------------------- 1 file changed, 1 insertion(+), 47 deletions(-) (limited to 'src/channel/app.rs') diff --git a/src/channel/app.rs b/src/channel/app.rs index 1b2cc48..a9a9e84 100644 --- a/src/channel/app.rs +++ b/src/channel/app.rs @@ -7,7 +7,7 @@ use crate::{ clock::DateTime, db::NotFound, event::{broadcaster::Broadcaster, repo::Provider as _, Event, Sequence}, - message::{repo::Provider as _, Message}, + message::repo::Provider as _, }; pub struct Channels<'a> { @@ -36,52 +36,6 @@ impl<'a> Channels<'a> { Ok(channel.as_created()) } - pub async fn all(&self, resume_point: Option) -> Result, InternalError> { - let mut tx = self.db.begin().await?; - let channels = tx.channels().all(resume_point).await?; - tx.commit().await?; - - let channels = channels - .into_iter() - .filter_map(|channel| { - channel - .events() - .filter(Sequence::up_to(resume_point)) - .collect() - }) - .collect(); - - Ok(channels) - } - - pub async fn messages( - &self, - channel: &Id, - resume_point: Option, - ) -> Result, Error> { - let mut tx = self.db.begin().await?; - let channel = tx - .channels() - .by_id(channel) - .await - .not_found(|| Error::NotFound(channel.clone()))?; - - let messages = tx - .messages() - .in_channel(&channel, resume_point) - .await? - .into_iter() - .filter_map(|message| { - message - .events() - .filter(Sequence::up_to(resume_point)) - .collect() - }) - .collect(); - - Ok(messages) - } - pub async fn delete(&self, channel: &Id, deleted_at: &DateTime) -> Result<(), Error> { let mut tx = self.db.begin().await?; -- cgit v1.2.3