mirror of
				https://github.com/Telecominfraproject/wlan-cloud-graphql-gw.git
				synced 2025-10-30 18:17:59 +00:00 
			
		
		
		
	Added optimization to reduce unnecessary requests
This commit is contained in:
		| @@ -264,18 +264,26 @@ export class API extends RESTDataSource { | |||||||
|     if (profile.profileType === 'ssid') { |     if (profile.profileType === 'ssid') { | ||||||
|       const { |       const { | ||||||
|         id, |         id, | ||||||
|         details: { passpointProfileId, passpointConfig }, |         details: { passpointProfileId = {}, passpointConfig }, | ||||||
|       } = profile; |       } = profile; | ||||||
|  |  | ||||||
|       const oldProfile = await this.get('portal/profile', { profileId: id }); |       const oldProfile = await this.get('portal/profile', { profileId: id }); | ||||||
|       if (oldProfile.childProfileIds.length) { |       if (oldProfile.childProfileIds.length) { | ||||||
|         const childProfiles = await this.get('portal/profile/inSet', { |         const childProfiles = | ||||||
|  |           (await this.get('portal/profile/inSet', { | ||||||
|             profileIdSet: oldProfile.childProfileIds, |             profileIdSet: oldProfile.childProfileIds, | ||||||
|         }); |           })) || []; | ||||||
|  |  | ||||||
|         const passpointProfile = childProfiles.find( |         const passpointProfile = childProfiles.find( | ||||||
|           (profile) => profile.profileType === 'passpoint' |           (profile) => profile.profileType === 'passpoint' | ||||||
|         ); |         ); | ||||||
|  |  | ||||||
|  |         console.log(passpointProfileId.value); | ||||||
|         if (passpointProfile) { |         if (passpointProfile) { | ||||||
|  |           if ( | ||||||
|  |             !passpointProfileId.value || | ||||||
|  |             passpointProfile.id !== parseInt(passpointProfileId.value, 10) | ||||||
|  |           ) { | ||||||
|             this.put('portal/profile', { |             this.put('portal/profile', { | ||||||
|               ...passpointProfile, |               ...passpointProfile, | ||||||
|               details: { |               details: { | ||||||
| @@ -292,7 +300,9 @@ export class API extends RESTDataSource { | |||||||
|             }); |             }); | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       if (passpointProfileId.value) { | ||||||
|         if (passpointConfig === 'accessSSID') { |         if (passpointConfig === 'accessSSID') { | ||||||
|           this.get('portal/profile', { |           this.get('portal/profile', { | ||||||
|             profileId: passpointProfileId.value, |             profileId: passpointProfileId.value, | ||||||
| @@ -340,6 +350,7 @@ export class API extends RESTDataSource { | |||||||
|           }); |           }); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     return this.put('portal/profile', { |     return this.put('portal/profile', { | ||||||
|       ...profile, |       ...profile, | ||||||
| @@ -352,9 +363,11 @@ export class API extends RESTDataSource { | |||||||
|  |  | ||||||
|     if (deletedProfile.profileType === 'ssid') { |     if (deletedProfile.profileType === 'ssid') { | ||||||
|       if (deletedProfile.childProfileIds.length) { |       if (deletedProfile.childProfileIds.length) { | ||||||
|         const childProfiles = await this.get('portal/profile/inSet', { |         const childProfiles = | ||||||
|  |           (await this.get('portal/profile/inSet', { | ||||||
|             profileIdSet: deletedProfile.childProfileIds, |             profileIdSet: deletedProfile.childProfileIds, | ||||||
|         }); |           })) || []; | ||||||
|  |  | ||||||
|         const passpointProfile = childProfiles.find( |         const passpointProfile = childProfiles.find( | ||||||
|           (profile) => profile.profileType === 'passpoint' |           (profile) => profile.profileType === 'passpoint' | ||||||
|         ); |         ); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 irtiza-h30
					irtiza-h30