-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55357da
commit ba33e49
Showing
1 changed file
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,100 @@ | ||
//todo | ||
use std::future::Future; | ||
|
||
use log::{error, info}; | ||
|
||
use crate::backend::FindError; | ||
|
||
use crate::device::{DeviceAndSub, DeviceUpdate}; | ||
use crate::episode::{Episode, EpisodeRaw}; | ||
use crate::podsync::{QueryEpisodes, Url}; | ||
use crate::subscription::SubscriptionChangesFromClient; | ||
use crate::user::User; | ||
use crate::Timestamp; | ||
|
||
type Result<T> = std::result::Result<T, ()>; | ||
|
||
pub struct Backend; | ||
|
||
pub async fn init() { | ||
} | ||
|
||
impl Backend { | ||
pub async fn new() -> Self { | ||
Self | ||
} | ||
} | ||
|
||
impl Backend { | ||
pub async fn find_user(&self, username: &str) -> std::result::Result<User, FindError> { | ||
todo!() | ||
} | ||
|
||
/// session_id: set to None to logout / make NULL | ||
pub async fn update_user(&self, username: &str, session_id: Option<&str>) -> bool { | ||
todo!() | ||
} | ||
|
||
pub async fn users_with_session(&self, session_id: &str) -> Result<Vec<User>> { | ||
todo!() | ||
} | ||
} | ||
|
||
impl Backend { | ||
pub async fn devices_for_user(&self, username: &str) -> Result<Vec<DeviceAndSub>> { | ||
todo!() | ||
} | ||
|
||
pub async fn update_device( | ||
&self, | ||
username: &str, | ||
device_id: &str, | ||
update: DeviceUpdate, | ||
) -> Result<()> { | ||
todo!() | ||
} | ||
} | ||
|
||
impl Backend { | ||
pub async fn subscriptions( | ||
&self, | ||
username: &str, | ||
device_id: &str, | ||
since: Timestamp, | ||
) -> Result<Vec<Url>> { | ||
todo!() | ||
} | ||
|
||
pub async fn update_subscriptions( | ||
&self, | ||
username: &str, | ||
device_id: &str, | ||
changes: &SubscriptionChangesFromClient, | ||
now: Timestamp, | ||
) -> Result<()> { | ||
todo!() | ||
} | ||
} | ||
|
||
impl Backend { | ||
pub async fn episodes(&self, username: &str, query: &QueryEpisodes) -> Result<Vec<EpisodeRaw>> { | ||
todo!() | ||
} | ||
|
||
pub async fn update_episodes( | ||
&self, | ||
username: &str, | ||
now: Timestamp, | ||
changes: Vec<Episode>, | ||
) -> Result<()> { | ||
todo!() | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
pub mod test { | ||
use sqlx::{migrate::MigrateDatabase, Pool, Sqlite, SqlitePool}; | ||
|
||
pub async fn create_db() -> Pool<Sqlite> { | ||
todo!() | ||
} | ||
} |