From ca69f19d0492ae420ba54a158676d246b0307be0 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Tue, 4 Feb 2020 10:48:34 -0500 Subject: Create data type for user visible entries --- src/models.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/models.rs') diff --git a/src/models.rs b/src/models.rs index 50e1877..c88f938 100644 --- a/src/models.rs +++ b/src/models.rs @@ -1,3 +1,4 @@ +use crate::schema::entries; use crate::schema::raw_data; use crate::schema::config; use crate::schema::strava_tokens; @@ -149,3 +150,21 @@ pub struct RawData { pub username: String, pub payload: Value, } + +#[derive(Insertable, Debug, Serialize, Deserialize, Clone)] +#[table_name = "entries"] +pub struct NewEntry<'a> { + pub username: &'a str, + pub entry_type: &'a str, + pub timestamp: Option>, + pub payload: Value, +} + +#[derive(Queryable, Debug, Serialize, Deserialize, Clone)] +pub struct Entry { + pub username: String, + pub entry_type: String, + pub id: i64, + pub timestamp: Option>, + pub payload: Value, +} -- cgit v1.2.3