Remove users store prototype

This commit is contained in:
Lennart
2023-09-07 18:43:41 +02:00
parent 72fc6bb387
commit 82f15733fa
2 changed files with 1 additions and 40 deletions

View File

@@ -1,2 +1,2 @@
pub mod calendar;
pub mod users;
pub mod models;

View File

@@ -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()),
}])
}
}