FEAT: Função que fecha um ticket no Hubsoft.

This commit is contained in:
tulioperdigao 2025-11-06 12:42:04 -03:00
parent a1be9223a5
commit 8e47f46459

View File

@ -55,6 +55,30 @@ const updateAtendimentoStatus = async (id_atendimento, newStatus) => {
} }
}; };
module.exports = { const closeAtendimento = async (id_atendimento, closingMessage) => {
updateAtendimentoStatus try {
const token = await getAuthToken();
const response = await axios.put(`${apiConfig.hubsoft.atendimentosUrl}${id_atendimento}`, {
"fechar_atendimento": true,
"parametros_fechamento": {
"descricao_fechamento": closingMessage
}
},
{
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
}
});
return response.data;
} catch (error) {
logError(`Erro ao fechar atendimento ID ${id_atendimento}:`, error.response ? error.response.data : error.message);
throw error;
}
};
module.exports = {
updateAtendimentoStatus,
closeAtendimento
}; };