paste: Make is_url an optional parameter in JSON body
Signed-off-by: ATechnoHazard <amolele@gmail.com>
This commit is contained in:
		
							parent
							
								
									d1625ce721
								
							
						
					
					
						commit
						2b785d3fe4
					
				| @ -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, | ||||
| } | ||||
|  | ||||
| @ -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) | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -2,7 +2,7 @@ table! { | ||||
|     pastes (id) { | ||||
|         id -> Nullable<Varchar>, | ||||
|         belongs_to -> Nullable<Varchar>, | ||||
|         is_url -> Bool, | ||||
|         is_url -> Nullable<Bool>, | ||||
|         content -> Text, | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user