diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2024-12-28 10:40:20 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2024-12-28 13:57:15 +0100 |
| commit | 6614f5a6adf3780553d6ebba55361ad913a6c438 (patch) | |
| tree | 8f178b2f074587d6d461741bae99381a01784127 /server/src/api_model.rs | |
| parent | 3010daec061acd4ee88266a759abab0ac18cd100 (diff) | |
Database connection
Diffstat (limited to 'server/src/api_model.rs')
| -rw-r--r-- | server/src/api_model.rs | 64 |
1 files changed, 44 insertions, 20 deletions
diff --git a/server/src/api_model.rs b/server/src/api_model.rs index 4b6eced..c5b1ce3 100644 --- a/server/src/api_model.rs +++ b/server/src/api_model.rs @@ -2,45 +2,69 @@ use serde::{Serialize}; #[derive(Serialize, Copy, Clone)] pub enum ReviewState { - DRAFT, - OPEN, - DROPPED, - CLOSED, + Draft, + Open, + Dropped, + Closed, } #[derive(Serialize)] -pub struct User<'r> { - pub username: &'r str, - pub name: &'r str, +pub struct User { + pub id: u64, + pub username: String, + pub name: String, pub active: bool, } #[derive(Serialize)] -pub struct Review<'r> { +pub struct Review { pub id: u64, - pub title: &'r str, - pub description: &'r str, - pub owner: &'r User<'r>, - pub reviewers: Vec<&'r User<'r>>, - pub watchers: Vec<&'r User<'r>>, + pub title: String, + pub description: String, + pub owner: User, + pub reviewers: Vec<User>, + pub watchers: Vec<User>, pub state: ReviewState, - pub progress: f64, + pub progress: f32, } #[derive(Serialize)] -pub struct ReviewEntry<'r> { +pub struct ReviewEntry { pub id: u64, - pub title: &'r str, - pub owner: &'r User<'r>, + pub title: String, + pub owner: User, pub state: ReviewState, - pub progress: f64, + pub progress: f32, +} + +#[derive(Serialize)] +pub struct Reviews { + pub offset: u32, + pub limit: u32, + pub total_count: u32, + pub more: bool, + pub reviews: Vec<ReviewEntry>, +} + +#[derive(Serialize)] +pub struct Project { + pub id: u64, + pub title: String, + pub description: String, + pub members: Vec<User>, +} + +#[derive(Serialize)] +pub struct ProjectEntry { + pub id: u64, + pub title: String, } #[derive(Serialize)] -pub struct Reviews<'r> { +pub struct Projects { pub offset: u32, pub limit: u32, pub total_count: u32, pub more: bool, - pub reviews: Vec<ReviewEntry<'r>>, + pub projects: Vec<ProjectEntry>, } |
