mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 07:02:24 +00:00
Refactor store crate
This commit is contained in:
@@ -3,7 +3,7 @@ use crate::Error;
|
|||||||
use actix_web::web::{Data, Path};
|
use actix_web::web::{Data, Path};
|
||||||
use actix_web::HttpResponse;
|
use actix_web::HttpResponse;
|
||||||
use rustical_auth::{AuthInfoExtractor, CheckAuthentication};
|
use rustical_auth::{AuthInfoExtractor, CheckAuthentication};
|
||||||
use rustical_store::calendar::Calendar;
|
use rustical_store::model::Calendar;
|
||||||
use rustical_store::CalendarStore;
|
use rustical_store::CalendarStore;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use rustical_dav::{
|
|||||||
resource::HandlePropfind,
|
resource::HandlePropfind,
|
||||||
xml::{multistatus::PropstatWrapper, MultistatusElement},
|
xml::{multistatus::PropstatWrapper, MultistatusElement},
|
||||||
};
|
};
|
||||||
use rustical_store::{event::Event, CalendarStore};
|
use rustical_store::{model::Event, CalendarStore};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use rustical_dav::{
|
|||||||
resource::HandlePropfind,
|
resource::HandlePropfind,
|
||||||
xml::{multistatus::PropstatWrapper, MultistatusElement},
|
xml::{multistatus::PropstatWrapper, MultistatusElement},
|
||||||
};
|
};
|
||||||
use rustical_store::{event::Event, CalendarStore};
|
use rustical_store::{model::Event, CalendarStore};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use rustical_dav::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
use rustical_store::{
|
use rustical_store::{
|
||||||
calendar::{format_synctoken, parse_synctoken},
|
model::calendar::{format_synctoken, parse_synctoken},
|
||||||
CalendarStore,
|
CalendarStore,
|
||||||
};
|
};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use async_trait::async_trait;
|
|||||||
use derive_more::derive::{From, Into};
|
use derive_more::derive::{From, Into};
|
||||||
use rustical_dav::resource::{InvalidProperty, Resource, ResourceService};
|
use rustical_dav::resource::{InvalidProperty, Resource, ResourceService};
|
||||||
use rustical_dav::xml::HrefElement;
|
use rustical_dav::xml::HrefElement;
|
||||||
use rustical_store::calendar::Calendar;
|
use rustical_store::model::Calendar;
|
||||||
use rustical_store::CalendarStore;
|
use rustical_store::CalendarStore;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use actix_web::{web::Data, HttpRequest};
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use derive_more::derive::{From, Into};
|
use derive_more::derive::{From, Into};
|
||||||
use rustical_dav::resource::{InvalidProperty, Resource, ResourceService};
|
use rustical_dav::resource::{InvalidProperty, Resource, ResourceService};
|
||||||
use rustical_store::event::Event;
|
use rustical_store::model::Event;
|
||||||
use rustical_store::CalendarStore;
|
use rustical_store::CalendarStore;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
pub mod calendar;
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod event;
|
pub mod model;
|
||||||
pub mod sqlite_store;
|
pub mod sqlite_store;
|
||||||
pub mod store;
|
pub mod store;
|
||||||
pub mod timestamps;
|
pub mod timestamp;
|
||||||
pub use error::Error;
|
pub use error::Error;
|
||||||
pub use store::CalendarStore;
|
pub use store::CalendarStore;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
timestamps::{parse_duration, CalDateTime},
|
timestamp::{parse_duration, CalDateTime},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
5
crates/store/src/model/mod.rs
Normal file
5
crates/store/src/model/mod.rs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
pub mod calendar;
|
||||||
|
pub mod event;
|
||||||
|
|
||||||
|
pub use calendar::Calendar;
|
||||||
|
pub use event::Event;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::calendar::Calendar;
|
use crate::model::Calendar;
|
||||||
use crate::event::Event;
|
use crate::model::Event;
|
||||||
use crate::{CalendarStore, Error};
|
use crate::{CalendarStore, Error};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use anyhow::Result;
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
use crate::{calendar::Calendar, event::Event};
|
use crate::model::{Calendar, Event};
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait CalendarStore: Send + Sync + 'static {
|
pub trait CalendarStore: Send + Sync + 'static {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ async fn test_init<CS: CalendarStore>(_store: CS) {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_create_event<CS: CalendarStore>(mut store: CS) {
|
async fn test_create_event<CS: CalendarStore>(mut store: CS) {
|
||||||
store
|
store
|
||||||
.insert_calendar(rustical_store::calendar::Calendar {
|
.insert_calendar(rustical_store::model::Calendar {
|
||||||
id: "test".to_owned(),
|
id: "test".to_owned(),
|
||||||
displayname: Some("Test Calendar".to_owned()),
|
displayname: Some("Test Calendar".to_owned()),
|
||||||
principal: "testuser".to_owned(),
|
principal: "testuser".to_owned(),
|
||||||
|
|||||||
Reference in New Issue
Block a user