ticker/libticker/src/model.rs

37 lines
796 B
Rust
Raw Normal View History

2019-10-10 04:09:14 +02:00
use chrono::NaiveDateTime;
2019-10-10 17:39:34 +02:00
use super::schema::{calendars, events};
2019-10-10 04:09:14 +02:00
2019-10-10 17:39:34 +02:00
#[derive(Debug, Queryable)]
2019-10-10 04:09:14 +02:00
pub struct Calendar {
pub id: String,
pub url: String,
pub last_fetch: Option<NaiveDateTime>,
pub last_success: Option<NaiveDateTime>,
pub error_message: Option<String>,
pub etag: Option<String>,
pub last_modified: Option<String>,
}
2019-10-10 17:39:34 +02:00
#[derive(Debug, Insertable)]
2019-10-10 04:09:14 +02:00
#[table_name = "calendars"]
pub struct NewCalendar {
pub id: String,
pub url: String,
pub last_fetch: Option<NaiveDateTime>,
}
2019-10-10 17:39:34 +02:00
#[derive(Debug, Queryable, Insertable)]
pub struct Event {
pub calendar: String,
pub id: String,
pub dtstart: NaiveDateTime,
pub dtend: Option<NaiveDateTime>,
pub summary: String,
pub location: Option<String>,
pub url: Option<String>,
}