@@ -10,7 +10,7 @@ use crate::{
1010} ;
1111use dates:: HistoricalDate ;
1212use geneagrab_providers:: com_structs:: { IdentifyRequest , IdentifyResponse , ExtractRequest } ;
13- use geneagrab_providers:: data:: PluginMetadata ;
13+ use geneagrab_providers:: data:: ProviderMetadata ;
1414use sea_orm:: QueryOrder ;
1515use sea_orm:: {
1616 ActiveModelTrait , ActiveValue :: NotSet , ColumnTrait , DbConn , EntityTrait , FromQueryResult ,
@@ -229,16 +229,16 @@ pub async fn get_registry_meta(db: &DbConn, id: u32) -> Result<RegistryMeta, Cor
229229pub async fn add_registry (
230230 db : & DbConn ,
231231 url : String ,
232- plugin_id : String ,
232+ provider_id : String ,
233233) -> Result < RegistryMeta , CoreError > {
234- tracing:: info!( "add_registry called with url: {url}, plugin_id : {plugin_id }" ) ;
234+ tracing:: info!( "add_registry called with url: {url}, provider_id : {provider_id }" ) ;
235235
236- let provider = crate :: plugins :: get_provider ( db, & plugin_id ) . await ?;
237- let identified = provider. identify ( IdentifyRequest { url : url. clone ( ) } ) . map_err ( |e| CoreError :: PluginError ( e. to_string ( ) ) ) ?;
236+ let provider = crate :: providers :: get_provider ( db, & provider_id ) . await ?;
237+ let identified = provider. identify ( IdentifyRequest { url : url. clone ( ) } ) . map_err ( |e| CoreError :: ProviderError ( e. to_string ( ) ) ) ?;
238238 let res = provider
239239 . extract_registry ( ExtractRequest { url, identified } )
240240 . await
241- . map_err ( |e| CoreError :: PluginError ( e. to_string ( ) ) ) ?;
241+ . map_err ( |e| CoreError :: ProviderError ( e. to_string ( ) ) ) ?;
242242
243243 let txn = db
244244 . begin ( )
@@ -281,30 +281,30 @@ pub async fn add_registry(
281281 Ok ( meta)
282282}
283283
284- pub async fn get_plugins_for_url (
284+ pub async fn get_providers_for_url (
285285 url : & str ,
286- ) -> Result < Vec < ( PluginMetadata , IdentifyResponse ) > , CoreError > {
287- let fetcher = crate :: plugins :: get_fetcher ( ) ?;
288- let providers = crate :: plugins :: get_providers ( "" , fetcher) ;
289- let mut compatible_plugins = Vec :: new ( ) ;
286+ ) -> Result < Vec < ( ProviderMetadata , IdentifyResponse ) > , CoreError > {
287+ let fetcher = crate :: providers :: get_fetcher ( ) ?;
288+ let providers = crate :: providers :: get_providers ( "" , fetcher) ;
289+ let mut compatible_providers = Vec :: new ( ) ;
290290
291291 for provider in providers {
292292 let meta = provider. metadata ( ) ;
293293 if let Ok ( identified) = provider. identify ( IdentifyRequest {
294294 url : url. to_string ( ) ,
295295 } ) {
296- compatible_plugins . push ( ( meta, identified) ) ;
296+ compatible_providers . push ( ( meta, identified) ) ;
297297 }
298298 }
299299
300- // Prioritize plugins that explicitly list the website as compatible
301- compatible_plugins . sort_by_key ( |( meta, _) | {
300+ // Prioritize providers that explicitly list the website as compatible
301+ compatible_providers . sort_by_key ( |( meta, _) | {
302302 Reverse (
303303 meta. suggested_websites
304304 . iter ( )
305305 . any ( |site| url. starts_with ( site. as_ref ( ) ) ) ,
306306 )
307307 } ) ;
308308
309- Ok ( compatible_plugins )
309+ Ok ( compatible_providers )
310310}
0 commit comments