mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
Remove users store prototype
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
pub mod calendar;
|
pub mod calendar;
|
||||||
pub mod users;
|
pub mod models;
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
use anyhow::{anyhow, Result};
|
|
||||||
use async_trait::async_trait;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
||||||
pub struct User {
|
|
||||||
pub id: String,
|
|
||||||
pub name: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl User {}
|
|
||||||
|
|
||||||
#[async_trait]
|
|
||||||
pub trait UserStore: Send + Sync + 'static {
|
|
||||||
async fn get_user(&self, id: &str) -> Result<User>;
|
|
||||||
async fn get_users(&self) -> Result<Vec<User>>;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct TestUserStore {}
|
|
||||||
|
|
||||||
#[async_trait]
|
|
||||||
impl UserStore for TestUserStore {
|
|
||||||
async fn get_user(&self, id: &str) -> Result<User> {
|
|
||||||
if id != "test" {
|
|
||||||
return Err(anyhow!("asd"));
|
|
||||||
}
|
|
||||||
Ok(User {
|
|
||||||
id: "test".to_string(),
|
|
||||||
name: Some("test".to_string()),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn get_users(&self) -> Result<Vec<User>> {
|
|
||||||
Ok(vec![User {
|
|
||||||
id: "test".to_string(),
|
|
||||||
name: Some("test".to_string()),
|
|
||||||
}])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user