tvl-depot/src/models.rs

27 lines
557 B
Rust
Raw Normal View History

use chrono::prelude::{DateTime, Utc};
use schema::{threads, posts};
#[derive(Identifiable, Queryable, Serialize)]
pub struct Thread {
pub id: i32,
pub title: String,
pub body: String,
pub posted: DateTime<Utc>,
}
#[derive(Identifiable, Queryable, Serialize, Associations)]
#[belongs_to(Thread)]
pub struct Post {
pub id: i32,
pub thread_id: i32,
pub body: String,
pub posted: DateTime<Utc>,
}
2018-04-08 19:41:28 +02:00
#[derive(Deserialize, Insertable)]
2018-04-08 19:41:28 +02:00
#[table_name="threads"]
pub struct NewThread {
pub title: String,
pub body: String,
}