added timestamp for feed items

This commit is contained in:
2023-10-24 19:19:47 +02:00
parent ee80cbd53b
commit e4a65416c7
11 changed files with 128 additions and 26 deletions
+10 -5
View File
@@ -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,
}
}
}
+6 -3
View File
@@ -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,
}
}
}