use sqlx::sqlite::SqlitePool; use crate::{ channel::repo::channels::{Channel, Provider as _}, error::BoxedError, }; pub struct Index<'a> { db: &'a SqlitePool, } impl<'a> Index<'a> { pub const fn new(db: &'a SqlitePool) -> Self { Self { db } } pub async fn for_authenticated(&self) -> Result, BoxedError> { let mut tx = self.db.begin().await?; let channels = tx.channels().all().await?; tx.commit().await?; Ok(channels) } }