diff --git a/src/core/paste/entity.rs b/src/core/paste/entity.rs index e41e88a..28f4d75 100644 --- a/src/core/paste/entity.rs +++ b/src/core/paste/entity.rs @@ -5,6 +5,6 @@ use crate::schema::pastes; pub struct Paste { pub id: Option, pub belongs_to: Option, - pub is_url: bool, + pub is_url: Option, pub content: String, } diff --git a/src/core/paste/service.rs b/src/core/paste/service.rs index 3f17aec..85429f0 100644 --- a/src/core/paste/service.rs +++ b/src/core/paste/service.rs @@ -5,7 +5,7 @@ use super::entity::Paste; use super::postgres; pub fn create_paste(paste: &mut Paste, conn: &PgConnection) -> Result { - paste.is_url = validator::validate_url(paste.content.clone()); + paste.is_url = Some(validator::validate_url(paste.content.clone())); postgres::create_paste(paste, conn) } diff --git a/src/schema.rs b/src/schema.rs index 74ca95f..614f666 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -2,7 +2,7 @@ table! { pastes (id) { id -> Nullable, belongs_to -> Nullable, - is_url -> Bool, + is_url -> Nullable, content -> Text, } }