Built motion from commit 64a6f4bc.|2.6.26
[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 _0x424a=['limit','then','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0x424a,0xc3));var _0xa424=function(_0x48e645,_0x53cc57){_0x48e645=_0x48e645-0x0;var _0x2902f5=_0x424a[_0x48e645];return _0x2902f5;};'use strict';var _=require(_0xa424('0x0'));var util=require(_0xa424('0x1'));var moment=require('moment');var BPromise=require(_0xa424('0x2'));var rs=require(_0xa424('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa424('0x4'))['db'];var utils=require(_0xa424('0x5'));var logger=require(_0xa424('0x6'))(_0xa424('0x7'));var config=require('../../config/environment');var jayson=require(_0xa424('0x8'));var client=jayson['client'][_0xa424('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16a15e,_0x157c6c,_0x520f69){return new BPromise(function(_0x47cdcd,_0x430a17){return client['request'](_0x16a15e,_0x520f69)['then'](function(_0x5a2610){logger['info'](_0xa424('0xa'),_0x157c6c,_0xa424('0xb'));logger[_0xa424('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x157c6c,'request\x20sent',JSON[_0xa424('0xd')](_0x5a2610));if(_0x5a2610[_0xa424('0xe')]){if(_0x5a2610[_0xa424('0xe')][_0xa424('0xf')]===0x1f4){logger[_0xa424('0xe')](_0xa424('0xa'),_0x157c6c,_0x5a2610[_0xa424('0xe')][_0xa424('0x10')]);return _0x430a17(_0x5a2610[_0xa424('0xe')][_0xa424('0x10')]);}logger[_0xa424('0xe')](_0xa424('0xa'),_0x157c6c,_0x5a2610['error'][_0xa424('0x10')]);return _0x47cdcd(_0x5a2610[_0xa424('0xe')]['message']);}else{logger['info'](_0xa424('0xa'),_0x157c6c,_0xa424('0xb'));_0x47cdcd(_0x5a2610[_0xa424('0x11')][_0xa424('0x10')]);}})[_0xa424('0x12')](function(_0x4c537c){logger[_0xa424('0xe')](_0xa424('0xa'),_0x157c6c,_0x4c537c);_0x430a17(_0x4c537c);});});}exports[_0xa424('0x13')]=function(_0x5b54b8){var _0x51d26e=this;return new Promise(function(_0x19ffe5,_0x448c56){return db['FaxQueueReport'][_0xa424('0x14')](_0x5b54b8[_0xa424('0x15')],{'raw':_0x5b54b8[_0xa424('0x16')]?_0x5b54b8[_0xa424('0x16')][_0xa424('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x33709c){logger['info'](_0xa424('0x13'),_0x5b54b8);logger[_0xa424('0xc')]('CreateFaxQueueReport',_0x5b54b8,JSON[_0xa424('0xd')](_0x33709c));_0x19ffe5(_0x33709c);})[_0xa424('0x12')](function(_0x187eaf){logger[_0xa424('0xe')](_0xa424('0x13'),_0x187eaf[_0xa424('0x10')],_0x5b54b8);_0x448c56(_0x51d26e[_0xa424('0xe')](0x1f4,_0x187eaf[_0xa424('0x10')]));});});};exports[_0xa424('0x18')]=function(_0x163ee9){var _0x225b27=this;return new Promise(function(_0x33e2f5,_0x1f0c6a){return db[_0xa424('0x19')][_0xa424('0x1a')](_0x163ee9[_0xa424('0x15')],{'raw':_0x163ee9['options']?_0x163ee9[_0xa424('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163ee9['options']?_0x163ee9['options'][_0xa424('0x1b')]||null:null,'attributes':_0x163ee9['options']?_0x163ee9['options'][_0xa424('0x1c')]||null:null,'limit':_0x163ee9[_0xa424('0x16')]?_0x163ee9[_0xa424('0x16')][_0xa424('0x1d')]||null:null})[_0xa424('0x1e')](function(_0x9ed6d0){logger[_0xa424('0x1f')](_0xa424('0x18'),_0x163ee9);logger['debug'](_0xa424('0x18'),_0x163ee9,JSON[_0xa424('0xd')](_0x9ed6d0));_0x33e2f5(_0x9ed6d0);})['catch'](function(_0x253b9a){logger['error'](_0xa424('0x18'),_0x253b9a[_0xa424('0x10')],_0x163ee9);_0x1f0c6a(_0x225b27['error'](0x1f4,_0x253b9a['message']));});});};