init: scripts diversos (crawlers, conversores, scrapers)
This commit is contained in:
34
email-cleaner/services/perfexCrmService.ts
Executable file
34
email-cleaner/services/perfexCrmService.ts
Executable file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* perfexCrmService.ts
|
||||
*
|
||||
* @author Descomplicar® Crescimento Digital
|
||||
* @link https://descomplicar.pt
|
||||
* @copyright 2025 Descomplicar®
|
||||
*/
|
||||
|
||||
import type { CrmSettings } from '../types';
|
||||
|
||||
/**
|
||||
* Simula a exclusão de tickets no Perfex CRM com base nos remetentes de e-mail.
|
||||
*/
|
||||
export const deleteTicketsFromSendersInPerfex = (
|
||||
settings: CrmSettings,
|
||||
senderEmails: string[]
|
||||
): Promise<number> => {
|
||||
console.log('Iniciando exclusão de tickets de spam/notificações no Perfex CRM...');
|
||||
console.log('Remetentes alvo:', senderEmails);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
if (!settings.url || !settings.token) {
|
||||
return reject(new Error('Não foi possível excluir tickets: URL do CRM ou Token não configurado.'));
|
||||
}
|
||||
if (settings.token === 'fail') {
|
||||
return reject(new Error('Falha ao excluir tickets no Perfex CRM.'));
|
||||
}
|
||||
const simulatedDeletedCount = Math.floor(Math.random() * senderEmails.length) + 1;
|
||||
console.log(`Sucesso! ${simulatedDeletedCount} tickets foram "excluídos" do Perfex CRM.`);
|
||||
resolve(simulatedDeletedCount);
|
||||
}, 1500);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user