-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge master[WTEL-4740](https://webitel.atlassian.net/browse/WTEL-4740)
- Loading branch information
Showing
18 changed files
with
358 additions
and
251 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 13 additions & 11 deletions
24
src/modules/configuration/components/the-configuration.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/modules/configuration/modules/lookups/modules/contact-groups/api/dymanicGroups.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { | ||
getDefaultInstance, getDefaultOpenAPIConfig, | ||
} from '@webitel/ui-sdk/src/api/defaults/index.js'; | ||
import applyTransform, { | ||
camelToSnake, | ||
notify, | ||
sanitize, | ||
snakeToCamel, | ||
} from '@webitel/ui-sdk/src/api/transformers/index.js'; | ||
import { DynamicGroupsApiFactory } from 'webitel-sdk'; | ||
|
||
const instance = getDefaultInstance(); | ||
const configuration = getDefaultOpenAPIConfig(); | ||
|
||
const dynamicContactGroupsService = new DynamicGroupsApiFactory(configuration, '', instance); | ||
|
||
const fieldsToSend = ['name', 'description', 'enabled', 'type', 'default_group_id']; | ||
|
||
const preRequestHandler = (item) => { | ||
return { | ||
...item, | ||
type: item.type.toUpperCase(), | ||
defaultGroupId: item.defaultGroup.id, | ||
} | ||
}; | ||
|
||
const addDynamicContactGroup = async (itemInstance) => { | ||
const item = applyTransform(itemInstance, [ | ||
preRequestHandler, | ||
camelToSnake(), | ||
sanitize(fieldsToSend), | ||
]); | ||
|
||
try { | ||
const response = await dynamicContactGroupsService.createDynamicGroup(item); | ||
return applyTransform(response.data, [ | ||
snakeToCamel() | ||
]); | ||
} catch (err) { | ||
throw applyTransform(err, [notify]); | ||
} | ||
}; | ||
|
||
const updateDynamicContactGroup = async ({ itemInstance, itemId: id }) => { | ||
const item = applyTransform(itemInstance, [preRequestHandler, camelToSnake(), sanitize(fieldsToSend)]); | ||
|
||
try { | ||
const response = await dynamicContactGroupsService.updateDynamicGroup(id, item); | ||
return applyTransform(response.data, [snakeToCamel()]); | ||
} catch (err) { | ||
throw applyTransform(err, [notify]); | ||
} | ||
}; | ||
|
||
const dynamicContactGroupsAPI = { | ||
add: addDynamicContactGroup, | ||
update: updateDynamicContactGroup, | ||
} | ||
|
||
export default dynamicContactGroupsAPI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.