| 1 |
use super::{NaiveDate, Result, UserId, async_trait}; |
| 2 |
|
| 3 |
|
| 4 |
#[async_trait] |
| 5 |
pub trait WeeklyReviewRepository: Send + Sync { |
| 6 |
|
| 7 |
async fn get_for_week( |
| 8 |
&self, |
| 9 |
user_id: UserId, |
| 10 |
week_start: NaiveDate, |
| 11 |
) -> Result<Option<crate::models::WeeklyReview>>; |
| 12 |
|
| 13 |
|
| 14 |
async fn upsert( |
| 15 |
&self, |
| 16 |
user_id: UserId, |
| 17 |
week_start: NaiveDate, |
| 18 |
notes: &str, |
| 19 |
) -> Result<crate::models::WeeklyReview>; |
| 20 |
|
| 21 |
|
| 22 |
async fn list_all(&self, user_id: UserId) -> Result<Vec<crate::models::WeeklyReview>>; |
| 23 |
|
| 24 |
|
| 25 |
async fn is_current_week_completed(&self, user_id: UserId) -> Result<bool>; |
| 26 |
|
| 27 |
|
| 28 |
async fn set_vacation_days( |
| 29 |
&self, |
| 30 |
user_id: UserId, |
| 31 |
week_start: NaiveDate, |
| 32 |
days: &[u8], |
| 33 |
) -> Result<()>; |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
#[async_trait] |
| 38 |
pub trait DailyNoteRepository: Send + Sync { |
| 39 |
|
| 40 |
async fn get_by_date( |
| 41 |
&self, |
| 42 |
user_id: UserId, |
| 43 |
date: NaiveDate, |
| 44 |
) -> Result<Option<crate::models::DailyNote>>; |
| 45 |
|
| 46 |
|
| 47 |
async fn upsert( |
| 48 |
&self, |
| 49 |
user_id: UserId, |
| 50 |
date: NaiveDate, |
| 51 |
went_well: &str, |
| 52 |
could_improve: &str, |
| 53 |
is_reviewed: bool, |
| 54 |
) -> Result<crate::models::DailyNote>; |
| 55 |
|
| 56 |
|
| 57 |
async fn list_all(&self, user_id: UserId) -> Result<Vec<crate::models::DailyNote>>; |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
#[async_trait] |
| 62 |
pub trait MonthlyReviewRepository: Send + Sync { |
| 63 |
|
| 64 |
async fn list_goals( |
| 65 |
&self, |
| 66 |
user_id: UserId, |
| 67 |
month: &str, |
| 68 |
) -> Result<Vec<crate::models::MonthlyGoal>>; |
| 69 |
|
| 70 |
|
| 71 |
async fn list_all_goals(&self, user_id: UserId) -> Result<Vec<crate::models::MonthlyGoal>>; |
| 72 |
|
| 73 |
|
| 74 |
async fn list_all_reflections( |
| 75 |
&self, |
| 76 |
user_id: UserId, |
| 77 |
) -> Result<Vec<crate::models::MonthlyReflection>>; |
| 78 |
|
| 79 |
|
| 80 |
async fn upsert_goal( |
| 81 |
&self, |
| 82 |
user_id: UserId, |
| 83 |
month: &str, |
| 84 |
text: &str, |
| 85 |
position: i32, |
| 86 |
) -> Result<crate::models::MonthlyGoal>; |
| 87 |
|
| 88 |
|
| 89 |
async fn update_goal_status( |
| 90 |
&self, |
| 91 |
id: crate::MonthlyGoalId, |
| 92 |
user_id: UserId, |
| 93 |
status: &crate::models::MonthlyGoalStatus, |
| 94 |
) -> Result<Option<crate::models::MonthlyGoal>>; |
| 95 |
|
| 96 |
|
| 97 |
async fn delete_goal(&self, id: crate::MonthlyGoalId, user_id: UserId) -> Result<bool>; |
| 98 |
|
| 99 |
|
| 100 |
async fn get_reflection( |
| 101 |
&self, |
| 102 |
user_id: UserId, |
| 103 |
month: &str, |
| 104 |
) -> Result<Option<crate::models::MonthlyReflection>>; |
| 105 |
|
| 106 |
|
| 107 |
async fn upsert_reflection( |
| 108 |
&self, |
| 109 |
user_id: UserId, |
| 110 |
month: &str, |
| 111 |
highlight: &str, |
| 112 |
change: &str, |
| 113 |
) -> Result<crate::models::MonthlyReflection>; |
| 114 |
} |
| 115 |
|