@@ -366,34 +366,20 @@ impl ListingService {
366
366
}
367
367
}
368
368
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
-
388
369
/// It converts the user listing request into an internal listing specification.
389
370
///
390
371
/// # Errors
391
372
///
392
373
/// Returns a `ServiceError::InvalidUserListing` if there is an incorrect value in the url params for the listing request.
393
374
pub async fn listing_specification_from_user_request (
394
375
& self ,
376
+ maybe_user_id : Option < UserId > ,
395
377
request : & ListingRequest ,
396
378
) -> Result < ListingSpecification , ServiceError > {
379
+ self . authorization_service
380
+ . authorize ( ACTION :: GenerateUserProfilesListing , maybe_user_id)
381
+ . await ?;
382
+
397
383
let settings = self . configuration . settings . read ( ) . await ;
398
384
let default_user_profile_page_size = settings. api . default_user_profile_page_size ;
399
385
let max_user_profile_page_size = settings. api . max_user_profile_page_size ;
@@ -447,6 +433,20 @@ impl ListingService {
447
433
search : request. search . clone ( ) ,
448
434
} )
449
435
}
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
+ }
450
450
}
451
451
452
452
#[ cfg_attr( test, automock) ]
0 commit comments