Add views field in the database

pull/1/head
kirbylife 2022-12-20 22:33:10 -06:00
parent aeacae85c3
commit 73b24a3a1c
3 changed files with 5 additions and 1 deletions

View File

@ -9,6 +9,7 @@ pub struct Post {
pub title: String,
pub content: String,
pub published: bool,
pub views: i32,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
}
@ -19,4 +20,5 @@ pub struct NewPost {
pub title: String,
pub content: String,
pub published: bool,
pub views: i32,
}

View File

@ -1,9 +1,10 @@
table! {
posts (id) {
id -> Int4,
id -> Integer,
title -> Varchar,
content -> Text,
published -> Bool,
views -> Integer,
created_at -> Timestamp,
updated_at -> Timestamp,
}

View File

@ -31,6 +31,7 @@
<label for="">Visible</label>
<input name="published" type="checkbox" value="true"/>
<textarea id="content" name="content"></textarea>
<input name="views" type="number" value="0" style="display: none"/>
<button>Publicar</button>
</form>
</div>