099b0e10bb3c03459ac7f95aba00ffee97ba922b
[motion2.git] / server / api / faxQueueReport / faxQueueReport.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x24a9=['jayson/promise','client','http','request','then','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','FaxQueueReport,\x20%s,\x20%s','message','result','FaxQueueReport','create','body','options','info','CreateFaxQueueReport','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x24a9,0xc8));var _0x924a=function(_0x54bdc6,_0x4e1136){_0x54bdc6=_0x54bdc6-0x0;var _0x522430=_0x24a9[_0x54bdc6];return _0x522430;};'use strict';var _=require(_0x924a('0x0'));var util=require(_0x924a('0x1'));var moment=require('moment');var BPromise=require(_0x924a('0x2'));var rs=require(_0x924a('0x3'));var fs=require('fs');var Redis=require(_0x924a('0x4'));var db=require(_0x924a('0x5'))['db'];var utils=require(_0x924a('0x6'));var logger=require(_0x924a('0x7'))(_0x924a('0x8'));var config=require(_0x924a('0x9'));var jayson=require(_0x924a('0xa'));var client=jayson[_0x924a('0xb')][_0x924a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3dcac0,_0x4df02b,_0x237937){return new BPromise(function(_0x211730,_0x294d7e){return client[_0x924a('0xd')](_0x3dcac0,_0x237937)[_0x924a('0xe')](function(_0x39d5b6){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x4df02b,'request\x20sent');logger[_0x924a('0xf')](_0x924a('0x10'),_0x4df02b,_0x924a('0x11'),JSON[_0x924a('0x12')](_0x39d5b6));if(_0x39d5b6['error']){if(_0x39d5b6['error'][_0x924a('0x13')]===0x1f4){logger[_0x924a('0x14')](_0x924a('0x15'),_0x4df02b,_0x39d5b6[_0x924a('0x14')][_0x924a('0x16')]);return _0x294d7e(_0x39d5b6[_0x924a('0x14')][_0x924a('0x16')]);}logger[_0x924a('0x14')](_0x924a('0x15'),_0x4df02b,_0x39d5b6['error'][_0x924a('0x16')]);return _0x211730(_0x39d5b6['error'][_0x924a('0x16')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x4df02b,'request\x20sent');_0x211730(_0x39d5b6[_0x924a('0x17')]['message']);}})['catch'](function(_0x584c27){logger['error'](_0x924a('0x15'),_0x4df02b,_0x584c27);_0x294d7e(_0x584c27);});});}exports['CreateFaxQueueReport']=function(_0x3d8751){var _0x1de7b5=this;return new Promise(function(_0x4ede4a,_0x1b269c){return db[_0x924a('0x18')][_0x924a('0x19')](_0x3d8751[_0x924a('0x1a')],{'raw':_0x3d8751[_0x924a('0x1b')]?_0x3d8751[_0x924a('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x924a('0xe')](function(_0x3c4f44){logger[_0x924a('0x1c')]('CreateFaxQueueReport',_0x3d8751);logger[_0x924a('0xf')](_0x924a('0x1d'),_0x3d8751,JSON[_0x924a('0x12')](_0x3c4f44));_0x4ede4a(_0x3c4f44);})['catch'](function(_0xa0be40){logger[_0x924a('0x14')]('CreateFaxQueueReport',_0xa0be40[_0x924a('0x16')],_0x3d8751);_0x1b269c(_0x1de7b5[_0x924a('0x14')](0x1f4,_0xa0be40[_0x924a('0x16')]));});});};exports[_0x924a('0x1e')]=function(_0x47c404){var _0x27d77e=this;return new Promise(function(_0x374c5c,_0x5c587b){return db[_0x924a('0x18')][_0x924a('0x1f')](_0x47c404[_0x924a('0x1a')],{'raw':_0x47c404[_0x924a('0x1b')]?_0x47c404[_0x924a('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47c404[_0x924a('0x1b')]?_0x47c404[_0x924a('0x1b')][_0x924a('0x20')]||null:null,'attributes':_0x47c404[_0x924a('0x1b')]?_0x47c404['options'][_0x924a('0x21')]||null:null,'limit':_0x47c404[_0x924a('0x1b')]?_0x47c404[_0x924a('0x1b')][_0x924a('0x22')]||null:null})['then'](function(_0x1e76ac){logger[_0x924a('0x1c')](_0x924a('0x1e'),_0x47c404);logger[_0x924a('0xf')](_0x924a('0x1e'),_0x47c404,JSON[_0x924a('0x12')](_0x1e76ac));_0x374c5c(_0x1e76ac);})['catch'](function(_0x352099){logger[_0x924a('0x14')](_0x924a('0x1e'),_0x352099[_0x924a('0x16')],_0x47c404);_0x5c587b(_0x27d77e[_0x924a('0x14')](0x1f4,_0x352099[_0x924a('0x16')]));});});};