added timestamp for feed items
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
// extern crate bcrypt;
|
||||
|
||||
// use bcrypt::{hash, DEFAULT_COST};
|
||||
use chrono::NaiveDateTime;
|
||||
use diesel::Insertable;
|
||||
// use uuid::Uuid;
|
||||
|
||||
use crate::schema::feed_item;
|
||||
|
||||
@@ -13,15 +10,23 @@ pub struct NewFeedItem {
|
||||
pub content: String,
|
||||
pub title: String,
|
||||
pub url: String,
|
||||
pub created_ts: Option<NaiveDateTime>,
|
||||
}
|
||||
|
||||
impl NewFeedItem {
|
||||
pub fn new(feed_id: i32, content: String, title: String, url: String) -> Self {
|
||||
pub fn new(
|
||||
feed_id: i32,
|
||||
content: String,
|
||||
title: String,
|
||||
url: String,
|
||||
created_ts: Option<NaiveDateTime>,
|
||||
) -> Self {
|
||||
Self {
|
||||
feed_id,
|
||||
content,
|
||||
title,
|
||||
url,
|
||||
created_ts,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::models::feed::rss_feed::Feed;
|
||||
use diesel::{Associations, Identifiable, Queryable};
|
||||
|
||||
use crate::schema::feed_item;
|
||||
#[derive(Clone, Queryable, Identifiable, Associations)]
|
||||
use chrono::NaiveDateTime;
|
||||
use diesel::{Associations, Identifiable, Queryable};
|
||||
#[derive(Clone, Identifiable, Queryable, Associations)]
|
||||
#[diesel(belongs_to(Feed))]
|
||||
#[diesel(table_name=feed_item)]
|
||||
pub struct FeedItem {
|
||||
@@ -12,6 +12,7 @@ pub struct FeedItem {
|
||||
pub read: bool,
|
||||
pub title: String,
|
||||
pub url: String,
|
||||
pub created_ts: Option<NaiveDateTime>,
|
||||
}
|
||||
|
||||
impl FeedItem {
|
||||
@@ -22,6 +23,7 @@ impl FeedItem {
|
||||
url: String,
|
||||
content: String,
|
||||
read: bool,
|
||||
created_ts: Option<NaiveDateTime>,
|
||||
) -> Self {
|
||||
Self {
|
||||
id,
|
||||
@@ -30,6 +32,7 @@ impl FeedItem {
|
||||
url,
|
||||
content,
|
||||
read,
|
||||
created_ts,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user