@ -176,18 +176,21 @@ pub async fn update_preferred(
///
///
/// Called during synthesis generation when a feed is discovered or re-verified.
/// Called during synthesis generation when a feed is discovered or re-verified.
/// Pass `rss_url = None` to clear a previously cached feed (e.g., feed no longer exists).
/// Pass `rss_url = None` to clear a previously cached feed (e.g., feed no longer exists).
/// Only updates the source if it belongs to the given user (ownership check).
pub async fn update_source_rss (
pub async fn update_source_rss (
pool : & PgPool ,
pool : & PgPool ,
source_id : Uuid ,
source_id : Uuid ,
user_id : Uuid ,
rss_url : Option < & str > ,
rss_url : Option < & str > ,
rss_discovered_at : Option < DateTime < Utc > > ,
rss_discovered_at : Option < DateTime < Utc > > ,
) -> Result < ( ) , AppError > {
) -> Result < ( ) , AppError > {
sqlx ::query (
sqlx ::query (
"UPDATE sources SET rss_url = $1, rss_discovered_at = $2 WHERE id = $3 ",
"UPDATE sources SET rss_url = $1, rss_discovered_at = $2 WHERE id = $3 AND user_id = $4 ",
)
)
. bind ( rss_url )
. bind ( rss_url )
. bind ( rss_discovered_at )
. bind ( rss_discovered_at )
. bind ( source_id )
. bind ( source_id )
. bind ( user_id )
. execute ( pool )
. execute ( pool )
. await ? ;
. await ? ;