Browse Source
			
			
			Feature/optimize info endpoint using promise.all (#3742)
			
				* Optimize by using Promise.all()
* Update changelog
			
			
				pull/3741/head^2
			
			
		 
		
			
				
					
						
						Thomas Kaul
					
					1 year ago
					
						
							committed by
							
								
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: B5690EEEBB952194
						
					
				
			
		
		
		
	
		
			
				 2 changed files with 
20 additions and 
14 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
 
			
				- 
					
					
					 
					apps/api/src/app/info/info.service.ts
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					### Changed | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Optimized the asynchronous operations using `Promise.all()` in the info service | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Extracted the users from the admin control panel endpoint to a dedicated endpoint | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Improved the language localization for Italian (`it`) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -54,9 +54,6 @@ export class InfoService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  public async get(): Promise<InfoItem> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    const info: Partial<InfoItem> = {}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    let isReadOnlyMode: boolean; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    const platforms = await this.platformService.getPlatforms({ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      orderBy: { name: 'asc' } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    const globalPermissions: string[] = []; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -100,22 +97,30 @@ export class InfoService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      globalPermissions.push(permissions.enableSystemMessage); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    const isUserSignupEnabled = | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      await this.propertyService.isUserSignupEnabled(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    const [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      benchmarks, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      demoAuthToken, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      isUserSignupEnabled, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      platforms, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      statistics, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      subscriptions, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      tags | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    ] = await Promise.all([ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      this.benchmarkService.getBenchmarkAssetProfiles(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      this.getDemoAuthToken(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      this.propertyService.isUserSignupEnabled(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      this.platformService.getPlatforms({ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        orderBy: { name: 'asc' } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      }), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      this.getStatistics(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      this.getSubscriptions(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      this.tagService.get() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    ]); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    if (isUserSignupEnabled) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      globalPermissions.push(permissions.createUserAccount); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    const [benchmarks, demoAuthToken, statistics, subscriptions, tags] = | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      await Promise.all([ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        this.benchmarkService.getBenchmarkAssetProfiles(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        this.getDemoAuthToken(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        this.getStatistics(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        this.getSubscriptions(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        this.tagService.get() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      ]); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      ...info, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      benchmarks, | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |