debug suporte
Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
1 parent
ff61085a29
commit
913df8c907
1 file changed
+25
-1
+25
-1
@@ -6257,7 +6257,31 @@ Digite /help para ver todos os comandos disponíveis!
|
|||||||
await this.bot.sendMessage(session.chatId, `🔍 Buscando técnicos disponíveis...`);
|
await this.bot.sendMessage(session.chatId, `🔍 Buscando técnicos disponíveis...`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resultado = await this.topsapp.obterTecnicos();
|
const location = session.dados.location || '';
|
||||||
|
|
||||||
|
// Buscar técnicos e funcionários em paralelo para comparar
|
||||||
|
const [resultadoTecnicos, resultadoFuncionarios] = await Promise.all([
|
||||||
|
this.topsapp.obterTecnicos(location),
|
||||||
|
this.topsapp.obterFuncionarios(location)
|
||||||
|
]);
|
||||||
|
|
||||||
|
// DEBUG: log comparativo para identificar qual endpoint bate com o sistema
|
||||||
|
const rawTecnicos = resultadoTecnicos?.data?.dados || [];
|
||||||
|
const rawFuncionarios = resultadoFuncionarios?.data?.dados || [];
|
||||||
|
|
||||||
|
console.log('🔍 [DEBUG] ===== ObterTecnicos =====');
|
||||||
|
console.log('Total:', rawTecnicos.length);
|
||||||
|
rawTecnicos.forEach((t, i) => console.log(` [${i}]`, JSON.stringify(t)));
|
||||||
|
|
||||||
|
console.log('🔍 [DEBUG] ===== ObterFuncionarios =====');
|
||||||
|
console.log('Total:', rawFuncionarios.length);
|
||||||
|
rawFuncionarios.forEach((t, i) => console.log(` [${i}]`, JSON.stringify(t)));
|
||||||
|
|
||||||
|
// Usar a lista que contiver os nomes esperados pelo sistema
|
||||||
|
// A lista de ObterTecnicos tem times/equipes (ex: INSTALAÇÃO-GUARAI),
|
||||||
|
// enquanto ObterFuncionarios tem pessoas (ex: MARCELA SOUSA SOARES).
|
||||||
|
// Se ObterTecnicos retornar nomes individuais, provavelmente é ObterFuncionarios que temos que usar.
|
||||||
|
const resultado = resultadoTecnicos;
|
||||||
|
|
||||||
if (!resultado.success) {
|
if (!resultado.success) {
|
||||||
await this.bot.sendMessage(session.chatId,
|
await this.bot.sendMessage(session.chatId,
|
||||||
|
|||||||
Reference in new issue
Block a user