move CalendarStore to separate file

This commit is contained in:
Lennart
2024-06-01 11:44:04 +02:00
parent 37ec7edca7
commit 7fcd9a17f5
16 changed files with 35 additions and 33 deletions

17
crates/store/src/store.rs Normal file
View File

@@ -0,0 +1,17 @@
use anyhow::Result;
use async_trait::async_trait;
use crate::{calendar::Calendar, event::Event};
#[async_trait]
pub trait CalendarStore: Send + Sync + 'static {
async fn get_calendar(&self, id: &str) -> Result<Calendar>;
async fn get_calendars(&self, owner: &str) -> Result<Vec<Calendar>>;
async fn insert_calendar(&mut self, cid: String, calendar: Calendar) -> Result<()>;
async fn delete_calendar(&mut self, cid: &str) -> Result<()>;
async fn get_events(&self, cid: &str) -> Result<Vec<Event>>;
async fn get_event(&self, cid: &str, uid: &str) -> Result<Event>;
async fn upsert_event(&mut self, cid: String, uid: String, ics: String) -> Result<()>;
async fn delete_event(&mut self, cid: &str, uid: &str) -> Result<()>;
}