paste: Make is_url an optional parameter in JSON body

Signed-off-by: ATechnoHazard <amolele@gmail.com>
This commit is contained in:
Amogh Lele 2020-07-02 12:37:56 +05:30
parent d1625ce721
commit 2b785d3fe4
No known key found for this signature in database
GPG Key ID: F475143EDEDEBA3C
3 changed files with 3 additions and 3 deletions

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,
}

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)
}

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,
}
}