Skip to content

Commit

Permalink
Merge branches 'fix/show-import-destination' and 'master' of https://…
Browse files Browse the repository at this point in the history
…github.com/webitel/client into fix/show-import-destination
  • Loading branch information
SviatoslavBar committed Jul 2, 2024
2 parents 3fbfad4 + 04fbb98 commit f600cb0
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions src/modules/contact-center/modules/agents/api/agents.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { getDefaultGetListResponse, getDefaultGetParams } from '@webitel/ui-sdk/src/api/defaults';
import {
getDefaultGetListResponse,
getDefaultGetParams,
} from '@webitel/ui-sdk/src/api/defaults';
import applyTransform, {
camelToSnake,
merge,
Expand Down Expand Up @@ -41,7 +44,9 @@ const getAgentsList = async (params) => {
notTeamId,
supervisorId,
notSkillId,
} = applyTransform(params, [merge(getDefaultGetParams()), starToSearch('search')]);
} = applyTransform(params, [
merge(getDefaultGetParams())
]);

try {
const response = await agentService.searchAgent(
Expand Down Expand Up @@ -95,7 +100,10 @@ const getAgent = async ({ itemId: id }) => {

try {
const response = await agentService.readAgent(id);
return applyTransform(response.data, [snakeToCamel(), merge(defaultObject)]);
return applyTransform(response.data, [
snakeToCamel(),
merge(defaultObject),
]);
} catch (err) {
throw applyTransform(err, [notify]);
}
Expand All @@ -115,7 +123,10 @@ const fieldsToSend = [
];

const addAgent = async ({ itemInstance }) => {
const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
const item = applyTransform(itemInstance, [
sanitize(fieldsToSend),
camelToSnake(),
]);
try {
const response = await agentService.createAgent(item);
return applyTransform(response.data, [snakeToCamel()]);
Expand All @@ -125,7 +136,10 @@ const addAgent = async ({ itemInstance }) => {
};

const patchAgent = async ({ changes, id }) => {
const body = applyTransform(changes, [sanitize(fieldsToSend), camelToSnake()]);
const body = applyTransform(changes, [
sanitize(fieldsToSend),
camelToSnake(),
]);
try {
const response = await agentService.patchAgent(id, body);
return applyTransform(response.data, [snakeToCamel()]);
Expand All @@ -135,7 +149,10 @@ const patchAgent = async ({ changes, id }) => {
};

const updateAgent = async ({ itemInstance, itemId: id }) => {
const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
const item = applyTransform(itemInstance, [
sanitize(fieldsToSend),
camelToSnake(),
]);
try {
const response = await agentService.updateAgent(id, item);
return applyTransform(response.data, [snakeToCamel()]);
Expand Down Expand Up @@ -167,7 +184,10 @@ const getAgentHistory = async (params) => {
page,
size,
sort = '-joined_at',
} = applyTransform(params, [merge(getDefaultGetParams()), starToSearch('search')]);
} = applyTransform(params, [
merge(getDefaultGetParams()),
starToSearch('search'),
]);

try {
const response = await agentService.searchAgentStateHistory(
Expand Down

0 comments on commit f600cb0

Please sign in to comment.