Add views field in the database
parent
aeacae85c3
commit
73b24a3a1c
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue