Skip to main content

max / goingson

1.8 KB · 47 lines History Blame Raw
1 use super::*;
2
3 /// Repository for saved view / filter configurations.
4 #[async_trait]
5 pub trait SavedViewRepository: Send + Sync {
6 /// Lists all saved views for a user.
7 async fn list_all(&self, user_id: UserId) -> Result<Vec<SavedView>>;
8
9 /// Lists pinned views for sidebar display.
10 async fn list_pinned(&self, user_id: UserId) -> Result<Vec<SavedView>>;
11
12 /// Gets a saved view by ID.
13 async fn get_by_id(&self, id: SavedViewId, user_id: UserId) -> Result<Option<SavedView>>;
14
15 /// Creates a new saved view.
16 async fn create(&self, user_id: UserId, view: NewSavedView) -> Result<SavedView>;
17
18 /// Updates an existing saved view.
19 async fn update(&self, id: SavedViewId, user_id: UserId, view: NewSavedView) -> Result<Option<SavedView>>;
20
21 /// Deletes a saved view.
22 async fn delete(&self, id: SavedViewId, user_id: UserId) -> Result<bool>;
23
24 /// Toggles the pinned status of a view.
25 async fn toggle_pinned(&self, id: SavedViewId, user_id: UserId) -> Result<Option<SavedView>>;
26
27 /// Updates the position of a view in the sidebar.
28 async fn update_position(&self, id: SavedViewId, user_id: UserId, position: i32) -> Result<Option<SavedView>>;
29 }
30
31 /// Repository for backup settings management.
32 #[async_trait]
33 pub trait BackupSettingsRepository: Send + Sync {
34 /// Gets the backup settings for a user.
35 async fn get(&self, user_id: UserId) -> Result<Option<crate::models::BackupSettings>>;
36
37 /// Creates or updates backup settings.
38 async fn upsert(
39 &self,
40 user_id: UserId,
41 settings: crate::models::NewBackupSettings,
42 ) -> Result<crate::models::BackupSettings>;
43
44 /// Updates the last backup timestamp.
45 async fn update_last_backup_at(&self, user_id: UserId, timestamp: DateTime<Utc>) -> Result<()>;
46 }
47