Cleaned up directory, created documentation and readme

This commit is contained in:
Leonard Lorenz 2020-10-23 00:20:26 +02:00
parent 8a70db9b42
commit d6aee1e99d
16 changed files with 71 additions and 2 deletions

20
site/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,
}

9
site/src/db/schema.rs Normal file
View file

@ -0,0 +1,9 @@
table! {
posts (id) {
id -> Integer,
title -> Text,
body -> Text,
published -> Bool,
publish_date -> Timestamp,
}
}