paste: Make is_url an optional parameter in JSON body

Signed-off-by: ATechnoHazard <amolele@gmail.com>
This commit is contained in:
sphericalkat committed 2020-07-02 12:37:56 +05:30
1 parent d1625ce721
commit 2b785d3fe4
3 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -5,6 +5,6 @@ use crate::schema::pastes;
pub struct Paste {
pub id: Option<String>,
pub belongs_to: Option<String>,
pub is_url: bool,
pub is_url: Option<bool>,
pub content: String,
}
+1 -1
View File
@@ -5,7 +5,7 @@ use super::entity::Paste;
use super::postgres;
pub fn create_paste(paste: &mut Paste, conn: &PgConnection) -> Result<usize> {
paste.is_url = validator::validate_url(paste.content.clone());
paste.is_url = Some(validator::validate_url(paste.content.clone()));
postgres::create_paste(paste, conn)
}
+1 -1
View File
@@ -2,7 +2,7 @@ table! {
pastes (id) {
id -> Nullable<Varchar>,
belongs_to -> Nullable<Varchar>,
is_url -> Bool,
is_url -> Nullable<Bool>,
content -> Text,
}
}