diff --git a/migrations/2019-10-07-174502_create_texts/up.sql b/migrations/2019-10-07-174502_create_texts/up.sql index ef44acf..12fed12 100644 --- a/migrations/2019-10-07-174502_create_texts/up.sql +++ b/migrations/2019-10-07-174502_create_texts/up.sql @@ -1,6 +1,5 @@ CREATE TABLE texts ( id INTEGER NOT NULL PRIMARY KEY, contents TEXT NOT NULL, - highlight INTEGER NOT NULL, created INTEGER NOT NULL DEFAULT (strftime('%s', 'now')) ); diff --git a/src/models.rs b/src/models.rs index 839ac14..4b41386 100644 --- a/src/models.rs +++ b/src/models.rs @@ -63,8 +63,6 @@ pub mod texts { pub id: i32, /// Text contents pub contents: String, - /// Whether to use syntax highlighting or not when serving that text - pub highlight: i32, /// Creation date and time as a UNIX timestamp pub created: i32, } @@ -77,7 +75,5 @@ pub mod texts { pub id: i32, /// Text contents pub contents: &'a str, - /// Whether to use syntax highlighting or not when serving that text - pub highlight: i32, } } diff --git a/src/queries.rs b/src/queries.rs index 94eff3b..a7002b9 100644 --- a/src/queries.rs +++ b/src/queries.rs @@ -174,20 +174,11 @@ pub mod texts { find!(texts, Text); /// REPLACE a text entry - pub fn replace( - r_id: i32, - r_contents: &str, - r_highlight: bool, - pool: Data, - ) -> QueryResult { + pub fn replace(r_id: i32, r_contents: &str, pool: Data) -> QueryResult { let conn: &SqliteConnection = &pool.get().unwrap(); let new_text = NewText { id: r_id, contents: r_contents, - highlight: match r_highlight { - true => 1, - false => 2, - }, }; diesel::replace_into(table) .values(&new_text) diff --git a/src/routes.rs b/src/routes.rs index f2109bc..eb15d3a 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -461,7 +461,6 @@ pub mod texts { #[derive(Deserialize)] pub struct PutText { pub contents: String, - pub highlight: bool, } /// PUT a new text entry @@ -476,10 +475,8 @@ pub mod texts { future::result(auth(identity, request, &token_hash)) .and_then(move |_| future::result(parse_id(&path))) .and_then(move |id| { - web::block(move || { - queries::texts::replace(id, &body.contents, body.highlight, pool) - }) - .then(|result| match_replace_result(result)) + web::block(move || queries::texts::replace(id, &body.contents, pool)) + .then(|result| match_replace_result(result)) }) .from_err() } diff --git a/src/schema.rs b/src/schema.rs index d1d7fdf..43cb46e 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -18,7 +18,6 @@ table! { texts (id) { id -> Integer, contents -> Text, - highlight -> Integer, created -> Integer, } }