@@ -366,34 +366,20 @@ impl ListingService {
366366 }
367367 }
368368
369- /// Returns a list of all the user profiles matching the search criteria.
370- ///
371- /// # Errors
372- ///
373- /// Returns a `ServiceError::DatabaseError` if the database query fails.
374- pub async fn generate_user_profile_listing (
375- & self ,
376- listing : & ListingSpecification ,
377- maybe_user_id : Option < UserId > ,
378- ) -> Result < UserProfilesResponse , ServiceError > {
379- self . authorization_service
380- . authorize ( ACTION :: GenerateUserProfilesListing , maybe_user_id)
381- . await ?;
382-
383- let user_profiles_response = self . user_profile_repository . generate_listing ( listing) . await ?;
384-
385- Ok ( user_profiles_response)
386- }
387-
388369 /// It converts the user listing request into an internal listing specification.
389370 ///
390371 /// # Errors
391372 ///
392373 /// Returns a `ServiceError::InvalidUserListing` if there is an incorrect value in the url params for the listing request.
393374 pub async fn listing_specification_from_user_request (
394375 & self ,
376+ maybe_user_id : Option < UserId > ,
395377 request : & ListingRequest ,
396378 ) -> Result < ListingSpecification , ServiceError > {
379+ self . authorization_service
380+ . authorize ( ACTION :: GenerateUserProfilesListing , maybe_user_id)
381+ . await ?;
382+
397383 let settings = self . configuration . settings . read ( ) . await ;
398384 let default_user_profile_page_size = settings. api . default_user_profile_page_size ;
399385 let max_user_profile_page_size = settings. api . max_user_profile_page_size ;
@@ -447,6 +433,20 @@ impl ListingService {
447433 search : request. search . clone ( ) ,
448434 } )
449435 }
436+
437+ /// Returns a list of all the user profiles matching the search criteria.
438+ ///
439+ /// # Errors
440+ ///
441+ /// Returns a `ServiceError::DatabaseError` if the database query fails.
442+ pub async fn generate_user_profile_listing (
443+ & self ,
444+ listing : & ListingSpecification ,
445+ ) -> Result < UserProfilesResponse , ServiceError > {
446+ let user_profiles_response = self . user_profile_repository . generate_listing ( listing) . await ?;
447+
448+ Ok ( user_profiles_response)
449+ }
450450}
451451
452452#[ cfg_attr( test, automock) ]
0 commit comments