Skip to main content

max / goingson

3.0 KB · 62 lines History Blame Raw
1 use super::*;
2
3 /// Repository for weekly review tracking.
4 #[async_trait]
5 pub trait WeeklyReviewRepository: Send + Sync {
6 /// Gets the weekly review for a specific week.
7 async fn get_for_week(&self, user_id: UserId, week_start: NaiveDate) -> Result<Option<crate::models::WeeklyReview>>;
8
9 /// Creates or updates a weekly review.
10 async fn upsert(&self, user_id: UserId, week_start: NaiveDate, notes: &str) -> Result<crate::models::WeeklyReview>;
11
12 /// Lists every weekly review for a user across all weeks (for full backup export).
13 async fn list_all(&self, user_id: UserId) -> Result<Vec<crate::models::WeeklyReview>>;
14
15 /// Checks if the current week's review is completed.
16 async fn is_current_week_completed(&self, user_id: UserId) -> Result<bool>;
17
18 /// Sets vacation days for a specific week.
19 async fn set_vacation_days(&self, user_id: UserId, week_start: NaiveDate, days: &[u8]) -> Result<()>;
20 }
21
22 /// Repository for daily review notes.
23 #[async_trait]
24 pub trait DailyNoteRepository: Send + Sync {
25 /// Gets the daily note for a specific date.
26 async fn get_by_date(&self, user_id: UserId, date: NaiveDate) -> Result<Option<crate::models::DailyNote>>;
27
28 /// Creates or updates a daily note (upsert by user_id + date).
29 async fn upsert(&self, user_id: UserId, date: NaiveDate, went_well: &str, could_improve: &str, is_reviewed: bool) -> Result<crate::models::DailyNote>;
30
31 /// Lists every daily note for a user (for full backup export).
32 async fn list_all(&self, user_id: UserId) -> Result<Vec<crate::models::DailyNote>>;
33 }
34
35 /// Repository for monthly review goals and reflections.
36 #[async_trait]
37 pub trait MonthlyReviewRepository: Send + Sync {
38 /// Gets all goals for a specific month.
39 async fn list_goals(&self, user_id: UserId, month: &str) -> Result<Vec<crate::models::MonthlyGoal>>;
40
41 /// Lists every goal for a user across all months (for full backup export).
42 async fn list_all_goals(&self, user_id: UserId) -> Result<Vec<crate::models::MonthlyGoal>>;
43
44 /// Lists every reflection for a user across all months (for full backup export).
45 async fn list_all_reflections(&self, user_id: UserId) -> Result<Vec<crate::models::MonthlyReflection>>;
46
47 /// Creates or updates a goal for a month at a given position (1-3).
48 async fn upsert_goal(&self, user_id: UserId, month: &str, text: &str, position: i32) -> Result<crate::models::MonthlyGoal>;
49
50 /// Updates the status of a goal.
51 async fn update_goal_status(&self, id: crate::MonthlyGoalId, user_id: UserId, status: &crate::models::MonthlyGoalStatus) -> Result<Option<crate::models::MonthlyGoal>>;
52
53 /// Deletes a goal.
54 async fn delete_goal(&self, id: crate::MonthlyGoalId, user_id: UserId) -> Result<bool>;
55
56 /// Gets the reflection for a specific month.
57 async fn get_reflection(&self, user_id: UserId, month: &str) -> Result<Option<crate::models::MonthlyReflection>>;
58
59 /// Creates or updates the reflection for a month.
60 async fn upsert_reflection(&self, user_id: UserId, month: &str, highlight: &str, change: &str) -> Result<crate::models::MonthlyReflection>;
61 }
62