Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: remove "*" from search request [WTEL-4626] #704

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading