summaryrefslogtreecommitdiff
path: root/src/models.rs
blob: d025cf047cd19c2c72f6cd2546028580b8be0cba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use serde::{Serialize, Deserialize};
use diesel::Queryable;
use crate::schema::posts;

#[derive(Queryable, Insertable, Serialize, Deserialize)]
#[table_name="posts"]
pub struct Post {
    pub id: i32,
    pub title: String,
    pub body: String,
    pub published: bool
}

#[derive(Serialize)]
pub struct PostResponse<'a> {
    pub msg: &'a str
}