Cleaned up directory, created documentation and readme
This commit is contained in:
parent
8a70db9b42
commit
d6aee1e99d
16 changed files with 71 additions and 2 deletions
20
site/src/db/models.rs
Normal file
20
site/src/db/models.rs
Normal 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
9
site/src/db/schema.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
table! {
|
||||
posts (id) {
|
||||
id -> Integer,
|
||||
title -> Text,
|
||||
body -> Text,
|
||||
published -> Bool,
|
||||
publish_date -> Timestamp,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue