summaryrefslogtreecommitdiff
path: root/src/index/app.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-09-18 22:49:38 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-09-20 16:42:44 -0400
commit22348bfa35f009e62abe2f30863e0434079a1fe2 (patch)
treec5b5b5e660a1ee2a05785f4669102c1023b6e7b0 /src/index/app.rs
parentaafdeb9ffaf9a993ca4462b3422667e04469b2e3 (diff)
Remove the HTML client, and expose a JSON API.
This API structure fell out of a conversation with Kit. Described loosely: kit: ok kit: Here's what I'm picturing in a client kit: list channels, make-new-channel, zero to one active channels, post-to-active. kit: login/sign-up, logout owen: you will likely also want "am I logged in" here kit: sure, whoami
Diffstat (limited to 'src/index/app.rs')
-rw-r--r--src/index/app.rs36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/index/app.rs b/src/index/app.rs
deleted file mode 100644
index 4f234ee..0000000
--- a/src/index/app.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-use sqlx::sqlite::SqlitePool;
-
-use crate::repo::{
- channel::{self, Channel, Provider as _},
- error::NotFound as _,
-};
-
-pub struct Index<'a> {
- db: &'a SqlitePool,
-}
-
-impl<'a> Index<'a> {
- pub const fn new(db: &'a SqlitePool) -> Self {
- Self { db }
- }
-
- pub async fn channel(&self, channel: &channel::Id) -> Result<Channel, Error> {
- let mut tx = self.db.begin().await?;
- let channel = tx
- .channels()
- .by_id(channel)
- .await
- .not_found(|| Error::ChannelNotFound(channel.clone()))?;
- tx.commit().await?;
-
- Ok(channel)
- }
-}
-
-#[derive(Debug, thiserror::Error)]
-pub enum Error {
- #[error("channel {0} not found")]
- ChannelNotFound(channel::Id),
- #[error(transparent)]
- DatabaseError(#[from] sqlx::Error),
-}