2020-04-23 03:28:51 +00:00
|
|
|
use super::schema::events;
|
2020-04-26 20:06:55 +00:00
|
|
|
use chrono::NaiveDateTime;
|
2020-04-23 03:28:51 +00:00
|
|
|
|
2020-04-27 22:13:23 +00:00
|
|
|
#[derive(Queryable, Clone)]
|
2020-04-23 03:28:51 +00:00
|
|
|
pub struct Event {
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Event ID
|
2020-04-23 03:28:51 +00:00
|
|
|
pub id: i32,
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Event name
|
2020-04-23 03:28:51 +00:00
|
|
|
pub event_name: String,
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Event long description
|
2020-04-23 03:28:51 +00:00
|
|
|
pub event_desc: String,
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Event datetime
|
2020-04-23 03:28:51 +00:00
|
|
|
pub event_time: NaiveDateTime,
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Event discord message id
|
2020-04-23 03:28:51 +00:00
|
|
|
pub message_id: String,
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Event message thumbnail link
|
2020-04-23 03:28:51 +00:00
|
|
|
pub thumbnail_link: String,
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Reminder sent tracker
|
2020-04-26 01:04:13 +00:00
|
|
|
pub reminder_sent: i32,
|
2020-04-23 03:28:51 +00:00
|
|
|
}
|
|
|
|
|
2020-04-27 22:13:23 +00:00
|
|
|
impl Into<NewEvent> for Event {
|
|
|
|
fn into(self) -> NewEvent {
|
|
|
|
NewEvent {
|
|
|
|
event_name: self.event_name.clone(),
|
|
|
|
event_desc: self.event_desc.clone(),
|
|
|
|
event_time: self.event_time.clone(),
|
|
|
|
message_id: self.message_id.clone(),
|
|
|
|
thumbnail_link: self.message_id.clone(),
|
|
|
|
reminder_sent: self.reminder_sent,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-26 20:06:55 +00:00
|
|
|
#[derive(Insertable, Clone)]
|
|
|
|
#[table_name = "events"]
|
2020-04-24 00:45:02 +00:00
|
|
|
pub struct NewEvent {
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Event name
|
2020-04-24 00:45:02 +00:00
|
|
|
pub event_name: String,
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Event long description
|
2020-04-24 00:45:02 +00:00
|
|
|
pub event_desc: String,
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Event datetime
|
2020-04-24 00:45:02 +00:00
|
|
|
pub event_time: NaiveDateTime,
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Event discord message id
|
2020-04-24 00:45:02 +00:00
|
|
|
pub message_id: String,
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Event message thumbnail link
|
2020-04-24 00:45:02 +00:00
|
|
|
pub thumbnail_link: String,
|
2020-04-26 20:06:55 +00:00
|
|
|
/// Reminder sent tracker
|
2020-04-26 01:04:13 +00:00
|
|
|
pub reminder_sent: i32,
|
2020-04-23 03:28:51 +00:00
|
|
|
}
|