mirror of
https://github.com/Telecominfraproject/wlan-cloud-graphql-gw.git
synced 2025-10-30 02:02:29 +00:00
Merge pull request #22 from Telecominfraproject/bugfix/NETEXP-1335
bugfix/NETEXP-1335: Passpoint profile childProfileIds fix
This commit is contained in:
@@ -204,9 +204,36 @@ export class API extends RESTDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createProfile(profile) {
|
async createProfile(profile) {
|
||||||
return this.post('portal/profile', {
|
const newProfile = await this.post('portal/profile', {
|
||||||
...profile,
|
...profile,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (profile.profileType === 'passpoint') {
|
||||||
|
const {
|
||||||
|
id,
|
||||||
|
details: { associatedAccessSsidProfileIds, osuSsidProfileId },
|
||||||
|
} = newProfile;
|
||||||
|
this.get('portal/profile', {
|
||||||
|
profileId: osuSsidProfileId,
|
||||||
|
}).then((profile) => {
|
||||||
|
this.put('portal/profile', {
|
||||||
|
...profile,
|
||||||
|
childProfileIds: [...profile.childProfileIds, id],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
associatedAccessSsidProfileIds.forEach((profileId) => {
|
||||||
|
this.get('portal/profile', {
|
||||||
|
profileId,
|
||||||
|
}).then((profile) => {
|
||||||
|
this.put('portal/profile', {
|
||||||
|
...profile,
|
||||||
|
childProfileIds: [...profile.childProfileIds, id],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return newProfile;
|
||||||
}
|
}
|
||||||
async getProfile(profileId) {
|
async getProfile(profileId) {
|
||||||
return this.get('portal/profile', {
|
return this.get('portal/profile', {
|
||||||
@@ -214,6 +241,35 @@ export class API extends RESTDataSource {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
async updateProfile(profile) {
|
async updateProfile(profile) {
|
||||||
|
if (profile.profileType === 'passpoint') {
|
||||||
|
const {
|
||||||
|
id,
|
||||||
|
details: { associatedAccessSsidProfileIds, osuSsidProfileId },
|
||||||
|
} = profile;
|
||||||
|
this.get('portal/profile', {
|
||||||
|
profileId: osuSsidProfileId,
|
||||||
|
}).then((profile) => {
|
||||||
|
if (!profile.childProfileIds.includes(parseInt(id, 10))) {
|
||||||
|
this.put('portal/profile', {
|
||||||
|
...profile,
|
||||||
|
childProfileIds: [...profile.childProfileIds, id],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
associatedAccessSsidProfileIds.forEach((profileId) => {
|
||||||
|
this.get('portal/profile', {
|
||||||
|
profileId,
|
||||||
|
}).then((profile) => {
|
||||||
|
if (!profile.childProfileIds.includes(parseInt(id, 10))) {
|
||||||
|
this.put('portal/profile', {
|
||||||
|
...profile,
|
||||||
|
childProfileIds: [...profile.childProfileIds, id],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return this.put('portal/profile', {
|
return this.put('portal/profile', {
|
||||||
...profile,
|
...profile,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -521,6 +521,18 @@ const resolvers = {
|
|||||||
|
|
||||||
return result && result.value2;
|
return result && result.value2;
|
||||||
},
|
},
|
||||||
|
associatedSsidProfiles: ({ details }, args, { dataSources }) => {
|
||||||
|
return (
|
||||||
|
details &&
|
||||||
|
details.associatedAccessSsidProfileIds &&
|
||||||
|
dataSources.api.getProfilesById(details.associatedAccessSsidProfileIds)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
osuSsidProfile: ({ details }, args, { dataSources }) => {
|
||||||
|
return (
|
||||||
|
details && details.osuSsidProfileId && dataSources.api.getProfile(details.osuSsidProfileId)
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
ClientSession: {
|
ClientSession: {
|
||||||
id: ({ macAddress }) => macAddress.addressAsString,
|
id: ({ macAddress }) => macAddress.addressAsString,
|
||||||
|
|||||||
@@ -231,6 +231,8 @@ const typeDefs = gql`
|
|||||||
lastModifiedTimestamp: String
|
lastModifiedTimestamp: String
|
||||||
equipmentCount: Int
|
equipmentCount: Int
|
||||||
details: JSONObject
|
details: JSONObject
|
||||||
|
associatedSsidProfiles: [Profile]
|
||||||
|
osuSsidProfile: Profile
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProfilePagination {
|
type ProfilePagination {
|
||||||
|
|||||||
Reference in New Issue
Block a user