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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
use crate::repository::schema::*;
use chrono::NaiveDate;

#[derive(Queryable, Debug, AsChangeset, Clone)]
pub struct SprintNumDate {
    pub sprint_num: i32,
    pub sprint_date: NaiveDate,
}

#[derive(Insertable, Clone)]
// db target must be specified as table_name
#[diesel(table_name = sprint_num_dates)]
pub struct NewSprint<'a> {
    pub sprint_num: i32,
    pub sprint_date: &'a NaiveDate,
}

#[derive(Queryable, Debug, AsChangeset, Clone)]
pub struct TeamReport {
    pub teams: String,
    pub sprint_num: i32,
    pub understand_easiest: String,
    pub understand_hardest: String,
    pub approach_easiest: String,
    pub approach_hardest: String,
    pub solve_easiest: String,
    pub solve_hardest: String,
    pub evaluate_easiest: String,
    pub evaluate_hardest: String,
    pub completion: i32,
    pub contact: String,
    pub comments: String,
    // TODO: pub is_completed: bool,
}

#[derive(Insertable, Clone)]
#[diesel(table_name = team_reports)]
pub struct NewTeamReport<'a> {
    pub teams: &'a str,
    pub sprint_num: i32,
}

#[derive(Queryable, Debug, AsChangeset, Clone)]
pub struct IndividualReport {
    pub email: String,
    pub sprint_num: i32,
    pub monday_time: i32,
    pub tuesday_time: i32,
    pub wednesday_time: i32,
    pub thursday_time: i32,
    pub friday_time: i32,
    pub saturday_time: i32,
    pub sunday_time: i32,
    pub discrepancy: String,
    pub request: String,
    // TODO: pub is_completed: bool,
}

#[derive(Insertable, Clone)]
#[diesel(table_name = individual_reports)]
pub struct NewIndividualReport<'a> {
    pub email: &'a str,
    pub sprint_num: i32,
}

#[derive(Debug, Queryable, AsChangeset, Clone)]
pub struct Requirement {
    pub teams: String,
    pub indexs: i32,
    pub description: String,
}

#[derive(Insertable)]
#[diesel(table_name = requirements)]
pub struct NewRequirement<'a> {
    pub teams: &'a str,
    pub indexs: i32,
}

#[derive(Debug, Queryable, AsChangeset, Clone)]
#[diesel(table_name = team_activities)]
pub struct TeamActivity {
    pub teams: String,
    pub email: String,
    pub sprint_num: i32,
    pub activity_index: i32,
    pub answers: String,
}

#[derive(Insertable, Clone)]
#[diesel(table_name = team_activities)]
pub struct NewTeamActivity<'a> {
    pub teams: &'a str,
    pub email: &'a str,
    pub sprint_num: i32,
}

#[derive(Debug, Queryable, AsChangeset, Clone)]
pub struct User {
    pub email: String,
    pub ouath_id: String,
    pub is_teacher: bool,
    pub is_student: bool,
    pub is_admin: bool,
    pub teams: String,
    pub class: String,
    pub first_name: String,
    pub last_name: String,
}

#[derive(Insertable, Clone)]
#[diesel(table_name = users)]
pub struct NewUser<'a> {
    pub email: &'a str,
    pub ouath_id: &'a str,
    pub first_name: &'a str,
    pub last_name: &'a str,
    pub teams: &'a str,
}