diff options
Diffstat (limited to 'src/models.rs')
-rw-r--r-- | src/models.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/models.rs b/src/models.rs index d8aa0aa..67038f1 100644 --- a/src/models.rs +++ b/src/models.rs @@ -1,7 +1,17 @@ -#[derive(Debug, Default, FromForm, Serialize, Queryable)] +use super::schema::posts; + +#[derive(Serialize, Queryable)] pub struct Post { pub id: i32, pub title: String, pub body: String, pub published: bool, } + +#[derive(Default, FromForm, Insertable)] +#[table_name="posts"] +pub struct NewPost { + pub title: String, + pub body: String, + pub published: bool, +} |