39 lines
875 B
Rust
Executable File
39 lines
875 B
Rust
Executable File
use crate::models::feed::rss_feed::Feed;
|
|
use crate::schema::feed_item;
|
|
use chrono::NaiveDateTime;
|
|
use diesel::{Associations, Identifiable, Queryable, Selectable};
|
|
#[derive(Clone, Identifiable, Selectable, Queryable, Associations)]
|
|
#[diesel(belongs_to(Feed))]
|
|
#[diesel(table_name=feed_item)]
|
|
pub struct FeedItem {
|
|
pub id: i32,
|
|
pub feed_id: i32,
|
|
pub content: String,
|
|
pub read: bool,
|
|
pub title: String,
|
|
pub url: String,
|
|
pub created_ts: Option<NaiveDateTime>,
|
|
}
|
|
|
|
impl FeedItem {
|
|
pub fn new(
|
|
id: i32,
|
|
feed_id: i32,
|
|
title: String,
|
|
url: String,
|
|
content: String,
|
|
read: bool,
|
|
created_ts: Option<NaiveDateTime>,
|
|
) -> Self {
|
|
Self {
|
|
id,
|
|
feed_id,
|
|
title,
|
|
url,
|
|
content,
|
|
read,
|
|
created_ts,
|
|
}
|
|
}
|
|
}
|