Change get articles to read from database instead of dummy data.

This commit is contained in:
2023-10-14 18:32:49 +02:00
parent c8ca91e90b
commit 3d77c6f30f
11 changed files with 157 additions and 61 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
pub mod new_feed_item;
mod rss_feed_item;
pub mod rss_feed_item;
+24 -4
View File
@@ -1,15 +1,35 @@
use crate::models::feed::rss_feed::Feed;
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 struct FeedItem {
pub id: i32,
pub feed_id: i32,
pub title: String,
pub url: String,
pub content: String,
pub read: bool,
pub title: String,
pub url: String,
}
impl FeedItem {
pub fn new(
id: i32,
feed_id: i32,
title: String,
url: String,
content: String,
read: bool,
) -> Self {
Self {
id,
feed_id,
title,
url,
content,
read,
}
}
}