const {fetchCommentsFromServiceNow } = require('../services/servicenowService'); const { syncCommentsGlpitoSN, syncCommentsSNtoGlpi } = require('../services/glpiCommentService'); const TicketSyncModel = require('../models/ticketSyncModel'); const processCommentsController = async () => { const ticketsSynced = await TicketSyncModel.getTicketsSynced(); for (ticket of ticketsSynced){ const comments = await fetchCommentsFromServiceNow(ticket); if(comments.length > 0){await syncCommentsSNtoGlpi(comments, ticket);} await syncCommentsGlpitoSN(ticket); } } module.exports = { processCommentsController }