Add categories to demo feeds

This commit is contained in:
Greg Shuflin 2025-02-03 16:32:40 -08:00
parent 411cdc5890
commit 0472ae2a14
3 changed files with 9 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "\n SELECT \n feed_id as \"feed_id: String\",\n name,\n url,\n user_id as \"user_id: String\",\n added_time as \"added_time: chrono::DateTime<chrono::Utc>\",\n last_checked_time as \"last_checked_time: chrono::DateTime<chrono::Utc>\",\n categorization as \"categorization: JsonValue\"\n FROM feeds\n WHERE user_id = ?\n ORDER BY added_time DESC\n ", "query": "\n SELECT \n feed_id as \"feed_id: String\",\n name,\n url,\n user_id as \"user_id: String\",\n added_time as \"added_time: chrono::DateTime<chrono::Utc>\",\n last_checked_time as \"last_checked_time: chrono::DateTime<chrono::Utc>\",\n categorization as \"categorization: JsonValue\"\n FROM feeds\n WHERE user_id = ?\n ORDER BY name ASC\n ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@ -52,5 +52,5 @@
false false
] ]
}, },
"hash": "7fa0f8d0047afea873a0622bcc26d7a5f903e11d59158768c41125ad36fa4810" "hash": "7c3a826ac9b9105554bed433100db0435c55fca5c239b4e5f58380e14697c3a0"
} }

View File

@ -46,25 +46,28 @@ pub async fn setup_demo_data(pool: &sqlx::SqlitePool) {
.await .await
.expect("Failed to create demo user"); .expect("Failed to create demo user");
let bbc_news = Feed::new( let mut bbc_news = Feed::new(
"BBC News".to_string(), "BBC News".to_string(),
"https://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml" "https://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml"
.parse() .parse()
.unwrap(), .unwrap(),
demo_id, demo_id,
); );
bbc_news.categorization = vec!["News".to_string()];
let xkcd = Feed::new( let mut xkcd = Feed::new(
"XKCD".to_string(), "XKCD".to_string(),
"https://xkcd.com/atom.xml".parse().unwrap(), "https://xkcd.com/atom.xml".parse().unwrap(),
demo_id, demo_id,
); );
xkcd.categorization = vec!["Webcomic".to_string()];
let isidore = Feed::new( let mut isidore = Feed::new(
"Isidore & Friends".to_string(), "Isidore & Friends".to_string(),
"https://isidore.webcomic.ws/rss/".parse().unwrap(), "https://isidore.webcomic.ws/rss/".parse().unwrap(),
demo_id, demo_id,
); );
isidore.categorization = vec!["Webcomic".to_string()];
let feeds = [bbc_news, xkcd, isidore]; let feeds = [bbc_news, xkcd, isidore];

View File

@ -130,7 +130,7 @@ pub async fn list_feeds(
categorization as "categorization: JsonValue" categorization as "categorization: JsonValue"
FROM feeds FROM feeds
WHERE user_id = ? WHERE user_id = ?
ORDER BY added_time DESC ORDER BY name ASC
"#, "#,
user_id user_id
) )