first working instance

This commit is contained in:
Leonard Lorenz 2020-10-22 00:17:52 +02:00
commit cfbeb07f37
13 changed files with 2555 additions and 0 deletions

20
src/db/models.rs Normal file
View file

@ -0,0 +1,20 @@
use super::schema::posts;
use serde::{Deserialize, Serialize};
#[derive(Queryable, Serialize, Deserialize)]
pub struct Post {
pub id: i32,
pub title: String,
pub body: String,
pub published: bool,
pub publish_date: chrono::NaiveDateTime,
}
#[derive(Insertable)]
#[table_name = "posts"]
pub struct NewPost<'a> {
pub title: &'a str,
pub body: &'a str,
pub published: &'a bool,
pub publish_date: &'a chrono::NaiveDateTime,
}