Skip to content

Commit

Permalink
fix: small refactor api [WTEL-4883](https://webitel.atlassian.net/bro…
Browse files Browse the repository at this point in the history
  • Loading branch information
Lera24 committed Dec 6, 2024
1 parent 2f95f2a commit dae9218
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const getSla = async ({ itemId: id }) => {
};

try {
const response = await slaService.locateSLA(id);
const response = await slaService.locateSLA(id, fieldsToSend);
return applyTransform(response.data, [
snakeToCamel(),
itemResponseHandler,
Expand All @@ -83,11 +83,11 @@ const preRequestHandler = (item) => {
};

const addSla = async ({ itemInstance }) => {
const fieldsToSend = ['name', 'description', 'validFrom', 'validTo', 'calendarId', 'reactionTime', 'resolutionTime'];
const fieldsToSend = ['name', 'description', 'valid_from', 'valid_to', 'calendar_id', 'reaction_time', 'resolution_time']; //difference with top list - field calendar_id
const item = applyTransform(itemInstance, [
preRequestHandler,
sanitize(fieldsToSend),
camelToSnake(),
sanitize(fieldsToSend),
]);
try {
const response = await slaService.createSLA(item);
Expand All @@ -100,8 +100,11 @@ const addSla = async ({ itemInstance }) => {
};

const updateSla = async ({ itemInstance, itemId: id }) => {
const item = applyTransform(itemInstance, [camelToSnake(), sanitize(fieldsToSend)]);

const fieldsToSend = ['name', 'description', 'valid_from', 'valid_to', 'calendar_id', 'reaction_time', 'resolution_time'];
const item = applyTransform(itemInstance, [
preRequestHandler,
camelToSnake(),
sanitize(fieldsToSend)]);
try {
const response = await slaService.updateSLA(id, item);
return applyTransform(response.data, [snakeToCamel()]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ const resettableState = {
itemInstance: {
name: '',
description: '',
calendar: {
id: '',
name: '',
},
calendar: {},
reactionTime: 0,
resolutionTime: 0,
validTo: 0,
Expand Down

0 comments on commit dae9218

Please sign in to comment.