MT#61843 Create call forward bugfix

Our tests have caught a weird behaviour for the endpoint
/cfdestinationsets v1 (mr11.5). The endpoint returns
an empty body after creating a new destination set.
This has been fixed by the backend team for versions
mr12.5 onward. To fix the problem in mr11.5 we add
an extra GET request to retrieve the new destination
set, before patching the mapping with the updated info.
NGCP-Flow: mr11.5

Change-Id: I3b42ce6682d4b51adea17e6d6bf7a0dd3cbb7860
(cherry picked from commit d9089dff49)
mr11.5.1
Debora Crescenzo 4 months ago committed by Crescenzo Debora
parent de0b22bf4f
commit 22bf9f81bf

@ -24,6 +24,20 @@ export async function cfLoadDestinationSets (subscriberId) {
})
}
export async function cfGetMostRecentDestinationSetByName (params) {
const res = await getList({
resource: 'cfdestinationsets',
params: {
name: params.name,
subscriber_id: params.subscriberId,
order_by: 'id',
order_by_direction: 'desc'
}
})
return res.items[0]
}
export async function cfLoadSourceSets (subscriberId) {
return getList({
resource: 'cfsourcesets',

@ -1,4 +1,5 @@
import {
cfCreateDestinationSet,
cfCreateOfficeHours,
cfCreateSourceSet,
cfCreateTimeSetDate,
@ -7,6 +8,7 @@ import {
cfDeleteDestinationSet,
cfDeleteSourceSet,
cfDeleteTimeSet,
cfGetMostRecentDestinationSetByName,
cfLoadDestinationSets,
cfLoadMappingsFull,
cfLoadSourceSets,
@ -61,22 +63,27 @@ export async function loadMappingsFull ({ dispatch, commit, rootGetters }, subsc
export async function createMapping ({ dispatch, commit, state, rootGetters }, payload) {
dispatch('wait/start', WAIT_IDENTIFIER, { root: true })
const name = 'csc-' + v4()
const subscriberId = (payload.subscriberId) ? (payload.subscriberId) : rootGetters['user/getSubscriberId']
await cfCreateDestinationSet({
name,
subscriber_id: subscriberId,
destinations: [createDefaultDestination()]
})
const destinationSet = await cfGetMostRecentDestinationSetByName({
name,
subscriberId: subscriberId
})
let type = payload.type
if (payload.type === 'cfu' && state.mappings.cft && state.mappings.cft.length > 0) {
type = 'cft'
}
const subscriberId = (payload.subscriberId) ? (payload.subscriberId) : rootGetters['user/getSubscriberId']
const mappings = _.cloneDeep(state.mappings[type])
const destinationSetId = await post({
resource: 'cfdestinationsets',
body: {
name: 'csc-' + v4(),
subscriber_id: subscriberId,
destinations: [createDefaultDestination()]
}
})
mappings.push({
destinationset_id: destinationSetId
destinationset_id: destinationSet.id
})
const res = await Promise.all([
patchReplaceFull({

Loading…
Cancel
Save