Built motion from commit ecb45b58.|2.6.31
[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 _0x11fa=['FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','update','where','attributes','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info'];(function(_0x1c5f52,_0x2bc4ef){var _0x4322bf=function(_0x3c1ba1){while(--_0x3c1ba1){_0x1c5f52['push'](_0x1c5f52['shift']());}};_0x4322bf(++_0x2bc4ef);}(_0x11fa,0xd9));var _0xa11f=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x11fa[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0xa11f('0x0'));var util=require(_0xa11f('0x1'));var moment=require(_0xa11f('0x2'));var BPromise=require(_0xa11f('0x3'));var rs=require(_0xa11f('0x4'));var fs=require('fs');var Redis=require(_0xa11f('0x5'));var db=require(_0xa11f('0x6'))['db'];var utils=require(_0xa11f('0x7'));var logger=require(_0xa11f('0x8'))(_0xa11f('0x9'));var config=require(_0xa11f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4056e2,_0x109187,_0x4445c7){return new BPromise(function(_0x2f06cf,_0x12ca05){return client[_0xa11f('0xb')](_0x4056e2,_0x4445c7)[_0xa11f('0xc')](function(_0x2ebc7c){logger[_0xa11f('0xd')](_0xa11f('0xe'),_0x109187,'request\x20sent');logger[_0xa11f('0xf')](_0xa11f('0x10'),_0x109187,_0xa11f('0x11'),JSON[_0xa11f('0x12')](_0x2ebc7c));if(_0x2ebc7c[_0xa11f('0x13')]){if(_0x2ebc7c[_0xa11f('0x13')]['code']===0x1f4){logger[_0xa11f('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x109187,_0x2ebc7c[_0xa11f('0x13')][_0xa11f('0x14')]);return _0x12ca05(_0x2ebc7c[_0xa11f('0x13')][_0xa11f('0x14')]);}logger['error'](_0xa11f('0xe'),_0x109187,_0x2ebc7c[_0xa11f('0x13')][_0xa11f('0x14')]);return _0x2f06cf(_0x2ebc7c['error'][_0xa11f('0x14')]);}else{logger[_0xa11f('0xd')](_0xa11f('0xe'),_0x109187,_0xa11f('0x11'));_0x2f06cf(_0x2ebc7c[_0xa11f('0x15')][_0xa11f('0x14')]);}})[_0xa11f('0x16')](function(_0x4b7eb8){logger[_0xa11f('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x109187,_0x4b7eb8);_0x12ca05(_0x4b7eb8);});});}exports[_0xa11f('0x17')]=function(_0x41d419){var _0x238dae=this;return new Promise(function(_0x12c331,_0x3b2f27){return db[_0xa11f('0x18')][_0xa11f('0x19')](_0x41d419[_0xa11f('0x1a')],{'raw':_0x41d419[_0xa11f('0x1b')]?_0x41d419['options'][_0xa11f('0x1c')]===undefined?!![]:![]:!![]})[_0xa11f('0xc')](function(_0x52fe63){logger[_0xa11f('0xd')](_0xa11f('0x17'),_0x41d419);logger[_0xa11f('0xf')](_0xa11f('0x17'),_0x41d419,JSON['stringify'](_0x52fe63));_0x12c331(_0x52fe63);})[_0xa11f('0x16')](function(_0x50ae83){logger[_0xa11f('0x13')](_0xa11f('0x17'),_0x50ae83['message'],_0x41d419);_0x3b2f27(_0x238dae['error'](0x1f4,_0x50ae83[_0xa11f('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x12e7dd){var _0x3563ff=this;return new Promise(function(_0x119b28,_0x3f16f1){return db['FaxQueueReport'][_0xa11f('0x1d')](_0x12e7dd[_0xa11f('0x1a')],{'raw':_0x12e7dd[_0xa11f('0x1b')]?_0x12e7dd[_0xa11f('0x1b')][_0xa11f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12e7dd[_0xa11f('0x1b')]?_0x12e7dd[_0xa11f('0x1b')][_0xa11f('0x1e')]||null:null,'attributes':_0x12e7dd[_0xa11f('0x1b')]?_0x12e7dd[_0xa11f('0x1b')][_0xa11f('0x1f')]||null:null,'limit':_0x12e7dd[_0xa11f('0x1b')]?_0x12e7dd['options']['limit']||null:null})[_0xa11f('0xc')](function(_0x20efed){logger[_0xa11f('0xd')](_0xa11f('0x20'),_0x12e7dd);logger[_0xa11f('0xf')](_0xa11f('0x20'),_0x12e7dd,JSON[_0xa11f('0x12')](_0x20efed));_0x119b28(_0x20efed);})['catch'](function(_0x1bea0b){logger['error'](_0xa11f('0x20'),_0x1bea0b['message'],_0x12e7dd);_0x3f16f1(_0x3563ff[_0xa11f('0x13')](0x1f4,_0x1bea0b['message']));});});};