Merge pull request 'fix-traitobject' (#1) from fix-traitobject into master

Reviewed-on: #1
master
kirbylife 2022-12-22 21:46:06 +00:00
commit 205d3c48e9
6 changed files with 9 additions and 4 deletions

View File

@ -5,7 +5,7 @@ authors = ["kirbylife <gabriel13m@gmail.com>"]
edition = "2018"
[dependencies]
rocket = "0.4.2"
rocket = "0.4.11"
diesel = { version = "1.0.0", features = ["postgres", "chrono"] }
dotenv = "0.9.0"
rand = "0.6.0"

View File

View File

@ -3,6 +3,8 @@ CREATE TABLE posts (
title VARCHAR NOT NULL,
content TEXT NOT NULL,
published BOOLEAN NOT NULL DEFAULT 'f',
views integer NOT NULL DEFAULT 0,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
)

View File

@ -1,10 +1,12 @@
table! {
// @generated automatically by Diesel CLI.
diesel::table! {
posts (id) {
id -> Integer,
id -> Int4,
title -> Varchar,
content -> Text,
published -> Bool,
views -> Integer,
views -> Int4,
created_at -> Timestamp,
updated_at -> Timestamp,
}

View File

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