mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 21:42:34 +00:00
store: Refactoring to split calendar and addressbook
This commit is contained in:
@@ -2,8 +2,7 @@ use crate::Error;
|
||||
use actix_web::web::{Data, Path};
|
||||
use actix_web::HttpResponse;
|
||||
use rustical_store::auth::User;
|
||||
use rustical_store::model::Calendar;
|
||||
use rustical_store::CalendarStore;
|
||||
use rustical_store::{Calendar, CalendarStore};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone, Debug)]
|
||||
|
||||
@@ -16,7 +16,7 @@ use rustical_dav::{
|
||||
MultistatusElement,
|
||||
},
|
||||
};
|
||||
use rustical_store::{model::object::CalendarObject, CalendarStore};
|
||||
use rustical_store::{CalendarObject, CalendarStore};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
|
||||
@@ -5,7 +5,7 @@ use rustical_dav::{
|
||||
resource::Resource,
|
||||
xml::{multistatus::PropstatWrapper, MultistatusElement},
|
||||
};
|
||||
use rustical_store::{model::object::CalendarObject, CalendarStore};
|
||||
use rustical_store::{CalendarObject, CalendarStore};
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -8,7 +8,7 @@ use rustical_dav::{
|
||||
},
|
||||
};
|
||||
use rustical_store::{
|
||||
model::calendar::{format_synctoken, parse_synctoken},
|
||||
calendar::{format_synctoken, parse_synctoken},
|
||||
CalendarStore,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
|
||||
@@ -15,8 +15,7 @@ use async_trait::async_trait;
|
||||
use derive_more::derive::{From, Into};
|
||||
use rustical_dav::resource::{InvalidProperty, Resource, ResourceService};
|
||||
use rustical_dav::xml::HrefElement;
|
||||
use rustical_store::model::Calendar;
|
||||
use rustical_store::CalendarStore;
|
||||
use rustical_store::{Calendar, CalendarStore};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -5,8 +5,7 @@ use actix_web::web::{Data, Path};
|
||||
use actix_web::HttpRequest;
|
||||
use actix_web::HttpResponse;
|
||||
use rustical_store::auth::User;
|
||||
use rustical_store::model::CalendarObject;
|
||||
use rustical_store::CalendarStore;
|
||||
use rustical_store::{CalendarObject, CalendarStore};
|
||||
use tracing::instrument;
|
||||
use tracing_actix_web::RootSpan;
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ use actix_web::{dev::ResourceMap, web::Data, HttpRequest};
|
||||
use async_trait::async_trait;
|
||||
use derive_more::derive::{From, Into};
|
||||
use rustical_dav::resource::{InvalidProperty, Resource, ResourceService};
|
||||
use rustical_store::model::object::CalendarObject;
|
||||
use rustical_store::CalendarStore;
|
||||
use rustical_store::{CalendarObject, CalendarStore};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::sync::Arc;
|
||||
use strum::{EnumString, VariantNames};
|
||||
|
||||
@@ -6,8 +6,7 @@ use actix_web::web::{Data, Path};
|
||||
use actix_web::HttpRequest;
|
||||
use actix_web::HttpResponse;
|
||||
use rustical_store::auth::User;
|
||||
use rustical_store::model::AddressObject;
|
||||
use rustical_store::AddressbookStore;
|
||||
use rustical_store::{AddressObject, AddressbookStore};
|
||||
use tracing::instrument;
|
||||
use tracing_actix_web::RootSpan;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ use actix_web::{dev::ResourceMap, web::Data, HttpRequest};
|
||||
use async_trait::async_trait;
|
||||
use derive_more::derive::{From, Into};
|
||||
use rustical_dav::resource::{InvalidProperty, Resource, ResourceService};
|
||||
use rustical_store::{model::AddressObject, AddressbookStore};
|
||||
use rustical_store::{AddressObject, AddressbookStore};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::sync::Arc;
|
||||
use strum::{EnumString, VariantNames};
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use crate::Error;
|
||||
use actix_web::web::Path;
|
||||
use actix_web::{web::Data, HttpResponse};
|
||||
use rustical_store::model::Addressbook;
|
||||
use rustical_store::{auth::User, AddressbookStore};
|
||||
use rustical_store::{auth::User, Addressbook, AddressbookStore};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone, Debug)]
|
||||
|
||||
@@ -16,7 +16,7 @@ use rustical_dav::{
|
||||
MultistatusElement,
|
||||
},
|
||||
};
|
||||
use rustical_store::{model::AddressObject, AddressbookStore};
|
||||
use rustical_store::{AddressObject, AddressbookStore};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
|
||||
@@ -12,7 +12,7 @@ use rustical_dav::{
|
||||
},
|
||||
};
|
||||
use rustical_store::{
|
||||
model::addressbook::{format_synctoken, parse_synctoken},
|
||||
addressbook::{format_synctoken, parse_synctoken},
|
||||
AddressbookStore,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
|
||||
@@ -12,8 +12,7 @@ use async_trait::async_trait;
|
||||
use derive_more::derive::{From, Into};
|
||||
use rustical_dav::resource::{InvalidProperty, Resource, ResourceService};
|
||||
use rustical_dav::xml::HrefElement;
|
||||
use rustical_store::model::Addressbook;
|
||||
use rustical_store::AddressbookStore;
|
||||
use rustical_store::{Addressbook, AddressbookStore};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -9,8 +9,7 @@ use askama::Template;
|
||||
use routes::login::{route_get_login, route_post_login};
|
||||
use rustical_store::{
|
||||
auth::{AuthenticationMiddleware, AuthenticationProvider, User},
|
||||
model::Calendar,
|
||||
CalendarStore,
|
||||
Calendar, CalendarStore,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
use crate::Error;
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct AddressObject {
|
||||
5
crates/store/src/addressbook/mod.rs
Normal file
5
crates/store/src/addressbook/mod.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
pub mod address_object;
|
||||
pub mod addressbook;
|
||||
|
||||
pub use address_object::*;
|
||||
pub use addressbook::*;
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
model::{AddressObject, Addressbook},
|
||||
addressbook::{AddressObject, Addressbook},
|
||||
Error,
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
|
||||
11
crates/store/src/calendar/mod.rs
Normal file
11
crates/store/src/calendar/mod.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
mod calendar;
|
||||
mod event;
|
||||
mod journal;
|
||||
mod object;
|
||||
mod todo;
|
||||
|
||||
pub use calendar::*;
|
||||
pub use event::*;
|
||||
pub use journal::*;
|
||||
pub use object::*;
|
||||
pub use todo::*;
|
||||
@@ -1,6 +1,5 @@
|
||||
use crate::calendar::{Calendar, CalendarObject};
|
||||
use crate::error::Error;
|
||||
use crate::model::object::CalendarObject;
|
||||
use crate::model::Calendar;
|
||||
use async_trait::async_trait;
|
||||
|
||||
#[async_trait]
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
pub mod addressbook;
|
||||
pub mod addressbook_store;
|
||||
pub mod calendar_store;
|
||||
pub mod error;
|
||||
pub mod model;
|
||||
pub mod timestamp;
|
||||
pub use error::Error;
|
||||
pub mod auth;
|
||||
pub mod calendar;
|
||||
|
||||
pub use addressbook_store::AddressbookStore;
|
||||
pub use calendar_store::CalendarStore;
|
||||
|
||||
pub use addressbook::{AddressObject, Addressbook};
|
||||
pub use calendar::{Calendar, CalendarObject};
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
pub mod calendar;
|
||||
pub mod event;
|
||||
pub mod journal;
|
||||
pub mod object;
|
||||
pub mod todo;
|
||||
|
||||
pub use calendar::Calendar;
|
||||
pub use object::CalendarObject;
|
||||
|
||||
pub mod addressbook;
|
||||
pub use addressbook::Addressbook;
|
||||
|
||||
pub mod address_object;
|
||||
pub use address_object::AddressObject;
|
||||
@@ -1,9 +1,6 @@
|
||||
use super::{ChangeOperation, SqliteStore};
|
||||
use async_trait::async_trait;
|
||||
use rustical_store::{
|
||||
model::{AddressObject, Addressbook},
|
||||
AddressbookStore,
|
||||
};
|
||||
use rustical_store::{AddressObject, Addressbook, AddressbookStore};
|
||||
use sqlx::{Sqlite, Transaction};
|
||||
use tracing::instrument;
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
use super::{ChangeOperation, SqliteStore};
|
||||
use async_trait::async_trait;
|
||||
use rustical_store::model::object::CalendarObject;
|
||||
use rustical_store::model::Calendar;
|
||||
use rustical_store::CalendarStore;
|
||||
use rustical_store::Error;
|
||||
use rustical_store::{Calendar, CalendarObject, CalendarStore, Error};
|
||||
use sqlx::Sqlite;
|
||||
use sqlx::Transaction;
|
||||
use tracing::instrument;
|
||||
|
||||
Reference in New Issue
Block a user