| 1 |
use super::*; |
| 2 |
|
| 3 |
|
| 4 |
#[async_trait] |
| 5 |
pub trait UserRepository: Send + Sync { |
| 6 |
|
| 7 |
async fn create(&self, email: &str, password: &str, display_name: &str) -> Result<User>; |
| 8 |
|
| 9 |
|
| 10 |
async fn find_by_email(&self, email: &str) -> Result<Option<User>>; |
| 11 |
|
| 12 |
|
| 13 |
async fn authenticate(&self, email: &str, password: &str) -> Result<Option<User>>; |
| 14 |
|
| 15 |
|
| 16 |
async fn update_last_login(&self, user_id: UserId) -> Result<()>; |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
#[async_trait] |
| 21 |
pub trait SyncAccountRepository: Send + Sync { |
| 22 |
|
| 23 |
async fn list_all(&self, user_id: UserId) -> Result<Vec<crate::models::SyncAccount>>; |
| 24 |
|
| 25 |
|
| 26 |
async fn get_by_id(&self, id: SyncAccountId, user_id: UserId) -> Result<Option<crate::models::SyncAccount>>; |
| 27 |
|
| 28 |
|
| 29 |
async fn create(&self, user_id: UserId, provider: &str, account_name: &str, email: Option<&str>) -> Result<crate::models::SyncAccount>; |
| 30 |
|
| 31 |
|
| 32 |
async fn update(&self, id: SyncAccountId, user_id: UserId, account_name: &str, sync_calendars: bool, sync_contacts: bool, enabled: bool) -> Result<Option<crate::models::SyncAccount>>; |
| 33 |
|
| 34 |
|
| 35 |
async fn delete(&self, id: SyncAccountId, user_id: UserId) -> Result<bool>; |
| 36 |
} |
| 37 |
|