use chrono::NaiveDateTime; use serde::Serialize; use super::schema::posts; #[derive(Queryable, Selectable, Serialize)] #[diesel(table_name = posts)] #[diesel(check_for_backend(diesel::sqlite::Sqlite))] pub struct Post { pub id: i32, pub title: String, pub content: String, pub published: bool, pub views: i32, pub created_at: NaiveDateTime, pub updated_at: NaiveDateTime, } #[derive(FromForm, Insertable, Debug)] #[diesel(table_name = posts)] pub struct NewPost { pub title: String, pub content: String, pub published: bool, pub views: i32, }