summaryrefslogtreecommitdiff
path: root/server/src/api_model.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/api_model.rs')
-rw-r--r--server/src/api_model.rs64
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>,
}