Update table feed items
This commit is contained in:
@@ -2,7 +2,7 @@ use super::super::user::rss_user::User;
|
||||
use crate::schema::feed;
|
||||
use diesel::{Associations, Identifiable, Queryable};
|
||||
|
||||
#[derive(Clone, Queryable, Identifiable, Associations)]
|
||||
#[derive(Clone, Debug, Queryable, Identifiable, Associations)]
|
||||
#[diesel(belongs_to(User))]
|
||||
#[diesel(table_name=feed)]
|
||||
pub struct Feed {
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
pub mod new_feed_item;
|
||||
mod rss_feed_item;
|
||||
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
// extern crate bcrypt;
|
||||
|
||||
// use bcrypt::{hash, DEFAULT_COST};
|
||||
use diesel::Insertable;
|
||||
// use uuid::Uuid;
|
||||
|
||||
use crate::schema::feed_item;
|
||||
|
||||
#[derive(Insertable, Clone)]
|
||||
#[diesel(table_name=feed_item)]
|
||||
pub struct NewFeedItem {
|
||||
pub feed_id: i32,
|
||||
pub content: String,
|
||||
pub title: String,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
impl NewFeedItem {
|
||||
pub fn new(feed_id: i32, content: String, title: String, url: String) -> Self {
|
||||
Self {
|
||||
feed_id,
|
||||
content,
|
||||
title,
|
||||
url,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// impl NewUser {
|
||||
// pub fn new(content: String, title: String, url: String) -> NewUser {
|
||||
// let hashed_password: String = hash(password.as_str(), DEFAULT_COST).unwrap();
|
||||
// let uuid = Uuid::new_v4();
|
||||
// NewUser {
|
||||
// username,
|
||||
// email,
|
||||
// password: hashed_password,
|
||||
// unique_id: uuid.to_string(),
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -1 +1,15 @@
|
||||
use diesel::{Associations, Identifiable, Queryable};
|
||||
|
||||
use crate::schema::feed_item;
|
||||
|
||||
#[derive(Clone, Queryable, Identifiable, Associations)]
|
||||
#[diesel(belongs_to(Feed))]
|
||||
#[diesel(table_name=feed_item)]
|
||||
pub struct Feed {
|
||||
pub id: i32,
|
||||
pub feed_id: i32,
|
||||
pub title: String,
|
||||
pub url: String,
|
||||
pub content: String,
|
||||
pub read: bool,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user