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
use crate::activity::ActivityType;
use bson::oid::ObjectId;
use getset::{Getters, Setters};
use serde::{Deserialize, Serialize};

#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::wasm_bindgen;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Debug, Serialize, Deserialize, Getters, Setters, Default, Clone)]
#[getset(get = "pub", set = "pub")]
#[serde(rename_all = "camelCase")]
pub struct Activity {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_id")]
    id: Option<ObjectId>,

    /// The rider id
    rider_id: String,

    /// The name of the activity
    name: Option<String>,

    /// The description of the activity
    description: Option<String>,

    /// The source of the data (external, manual, admin entry, etc)
    data_source: Option<String>,

    /// The name of the data source, if external
    external_source_name: Option<String>,

    /// The external unique identifier of the activity from the external source (e.g., strava activity id)
    external_activity_id: Option<String>,

    /// The external id of the athlete
    external_athlete_id: Option<String>,

    /// The activity type. Could be Ride, Run, etc.
    activity_type: Option<ActivityType>,

    /// The activity's distance, in meters
    pub distance: Option<f32>,

    /// The activity's moving time, in seconds
    pub moving_time: Option<i32>,

    /// The activity's elapsed time, in seconds
    pub elapsed_time: Option<i32>,

    /// The activity's total elevation gain.
    pub total_elevation_gain: Option<f32>,

    /// The time at which the activity was started
    start_date: Option<String>,

    /// The timestamp at which the activity was started
    pub start_timestamp: Option<i64>,

    /// The time at which the activity was started, in local timezone
    start_date_local: Option<String>,

    /// The timestamp at which the activity was started, in local timezone
    pub start_timestamp_local: Option<i64>,

    /// The date of local start date
    pub start_day_local: Option<i32>,

    /// The month of local start date
    pub start_month_local: Option<i32>,

    /// The year of local start date
    pub start_year_local: Option<i32>,

    /// The timezone of the activity
    timezone: Option<String>,

    /// The UTC offset of the local timezone
    pub utc_offset: Option<f32>,

    /// Whether this activity is a commute
    pub commute: Option<bool>,

    /// Whether this activity was created manually
    pub manual: Option<bool>,

    /// Whether this activity is private
    pub private: Option<bool>,

    /// Whether this activity is flagged
    pub flagged: Option<bool>,

    /// The activity's workout type
    pub workout_type: Option<i32>,
}