| 1 |
use super::*; |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#[async_trait] |
| 7 |
pub trait ProjectRepository: Send + Sync { |
| 8 |
|
| 9 |
async fn list_all(&self, user_id: UserId) -> Result<Vec<Project>>; |
| 10 |
|
| 11 |
|
| 12 |
async fn get_by_id(&self, id: ProjectId, user_id: UserId) -> Result<Option<Project>>; |
| 13 |
|
| 14 |
|
| 15 |
async fn create(&self, user_id: UserId, project: NewProject) -> Result<Project>; |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
async fn restore(&self, user_id: UserId, project: &Project) -> Result<()>; |
| 21 |
|
| 22 |
|
| 23 |
async fn update( |
| 24 |
&self, |
| 25 |
id: ProjectId, |
| 26 |
user_id: UserId, |
| 27 |
project: crate::models::UpdateProject, |
| 28 |
) -> Result<Option<Project>>; |
| 29 |
|
| 30 |
|
| 31 |
async fn delete(&self, id: ProjectId, user_id: UserId) -> Result<bool>; |
| 32 |
|
| 33 |
|
| 34 |
async fn find_by_name(&self, user_id: UserId, name: &str) -> Result<Option<Project>>; |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
#[async_trait] |
| 39 |
pub trait MilestoneRepository: Send + Sync { |
| 40 |
|
| 41 |
async fn list_by_project(&self, project_id: ProjectId, user_id: UserId) -> Result<Vec<crate::models::Milestone>>; |
| 42 |
|
| 43 |
|
| 44 |
async fn list_all(&self, user_id: UserId) -> Result<Vec<crate::models::Milestone>>; |
| 45 |
|
| 46 |
|
| 47 |
async fn get_by_id(&self, id: MilestoneId, user_id: UserId) -> Result<Option<crate::models::Milestone>>; |
| 48 |
|
| 49 |
|
| 50 |
async fn create(&self, user_id: UserId, milestone: crate::models::NewMilestone) -> Result<crate::models::Milestone>; |
| 51 |
|
| 52 |
|
| 53 |
async fn update( |
| 54 |
&self, |
| 55 |
id: MilestoneId, |
| 56 |
user_id: UserId, |
| 57 |
name: &str, |
| 58 |
description: &str, |
| 59 |
target_date: Option<NaiveDate>, |
| 60 |
status: &crate::models::MilestoneStatus, |
| 61 |
) -> Result<Option<crate::models::Milestone>>; |
| 62 |
|
| 63 |
|
| 64 |
async fn delete(&self, id: MilestoneId, user_id: UserId) -> Result<bool>; |
| 65 |
|
| 66 |
|
| 67 |
async fn reorder(&self, project_id: ProjectId, user_id: UserId, milestone_ids: &[MilestoneId]) -> Result<()>; |
| 68 |
} |
| 69 |
|