summaryrefslogtreecommitdiff
path: root/src/models.rs
blob: d8796d0b960143283a08d222699ff8408405c5d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use chrono::NaiveDateTime;
use serde::Serialize;

use super::schema::*;

#[derive(Serialize, Queryable, Insertable)]
pub struct Device {
    pub device_id: String,
    pub name: String,
}

#[derive(Serialize, Queryable, Insertable)]
#[diesel(table_name = data)]
pub struct Datapoint {
    pub device_id: String,
    pub timestamp: NaiveDateTime,
    pub value: f64,
}