summaryrefslogtreecommitdiff
path: root/server/src/api_model.rs
blob: 1c02f6c96bbad565ac14812eaf8d7a7d8471c13c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
use serde::Serialize;

#[derive(Serialize, Copy, Clone)]
pub enum ReviewState {
    Draft,
    Open,
    Dropped,
    Closed,
}

#[derive(Serialize)]
pub struct User {
    pub id: u64,
    pub username: String,
    pub name: String,
    pub active: bool,
}

#[derive(Serialize)]
pub struct Review {
    pub id: u64,
    pub title: String,
    pub description: String,
    pub owner: User,
    pub reviewers: Vec<User>,
    pub watchers: Vec<User>,
    pub state: ReviewState,
    pub progress: f32,
}

#[derive(Serialize)]
pub struct ReviewEntry {
    pub id: u64,
    pub title: String,
    pub owner: User,
    pub state: ReviewState,
    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 Projects {
    pub offset: u32,
    pub limit: u32,
    pub total_count: u32,
    pub more: bool,
    pub projects: Vec<ProjectEntry>,
}