1
2use serde::{Deserialize, Serialize};
3use std::collections::{HashMap, HashSet};
4
5#[derive(Debug, Serialize, Deserialize)]
6pub struct Customer {
7 #[serde(rename = "_id")]
8 pub id: String,
9 pub name: String,
10 pub image: Option<String>,
11}
12
13#[derive(Debug, Serialize, Deserialize)]
14pub struct WeekData {
15 #[serde(rename = "_id")]
16 pub id: Option<String>,
17 pub project: Option<String>,
18 pub employee: Option<String>,
19 pub start: Option<String>,
20 pub end: Option<String>,
21 pub activity: Option<String>,
22 pub created_by: Option<String>,
23 pub updated_by: Option<String>,
24 pub created_at: Option<String>,
25 pub updated_at: Option<String>,
26 #[serde(rename = "__v")]
27 pub v: Option<f64>,
28 pub weeks: Option<HashMap<String, f64>>,
29 pub comments: Option<HashMap<String, String>>,
30 #[serde(rename = "dayPlanning)]")]
31 pub day_planning: Option<HashMap<String, bool>>,
32 #[serde(rename = "weekdayHours)]")]
33 pub weekday_hours: Option<HashMap<String, HashMap<String, Option<f64>>>>,
34 pub preliminary: Option<HashMap<String, serde_json::Value>>,
35}
36
37
38
39#[derive(Debug, Serialize, Deserialize)]
40pub struct Project {
41 #[serde(rename = "_id")]
42 pub id: String,
43 #[serde(rename = "customerId")]
45 pub customer_id: Option<String>,
46 pub finished: Option<bool>,
47 pub name: String,
48}
68
69#[derive(Debug, Serialize, Deserialize)]
70pub struct Activity {
71 #[serde(rename = "activityId)]")]
72 pub activity_id: Option<String>,
73 pub name: Option<String>,
74 pub rate: Option<f64>,
75 pub active: Option<bool>,
76 #[serde(rename = "_id")]
77 pub id: Option<String>,
78 pub hours: Option<f64>,
79}
80
81#[derive(Debug, Serialize, Deserialize)]
82pub struct Employee {
83 #[serde(rename = "_id")]
84 pub id: String,
85 pub name: String,
86 pub email: String,
87 pub title: Option<String>,
88 pub image: Option<String>,
89 pub user_id: Option<String>,
90 pub color: Option<String>,
91}
92
93#[derive(Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
94pub struct CompactEmployee {
95 pub name: String,
96 pub image: Option<String>,
97}
98
99#[derive(Debug, Serialize, Deserialize)]
100pub struct CompactProject {
101 pub project: String,
102 pub image: Option<String>,
103 pub employees: HashSet<CompactEmployee>,
104}
105
106#[derive(Debug, Serialize, Deserialize)]
107pub struct MonthlyAnalysis {
108 pub all_hours: f64,
109 pub all_hours_billable: f64,
110 pub all_hours_non_billable: f64,
111 pub all_hours_with_cost: f64,
112 pub billing_rate: f64,
113 pub average_rate: f64,
114 pub total_invoiced: f64,
115 pub hours_away: f64,
116}
117
118
119
120