mi/backend/src/models.rs

23 lines
477 B
Rust
Raw Normal View History

2020-11-02 18:06:50 +00:00
use crate::schema::*;
use chrono::NaiveDateTime;
use serde::Serialize;
#[derive(Queryable, Debug, Serialize)]
2020-09-13 16:07:06 +00:00
pub struct Member {
pub id: i32,
2020-11-02 18:06:50 +00:00
#[serde(rename = "name")]
2020-09-13 16:07:06 +00:00
pub cmene: String,
pub picurl: String,
}
2020-11-02 18:06:50 +00:00
#[derive(Queryable, Associations)]
#[belongs_to(Member)]
#[table_name = "switches"]
2020-09-13 16:07:06 +00:00
pub struct Switch {
pub id: String,
2020-11-02 18:06:50 +00:00
pub member_id: i32,
pub started_at: NaiveDateTime,
pub ended_at: Option<NaiveDateTime>,
pub duration: i32,
2020-09-13 16:07:06 +00:00
}