Built motion from commit ae138b72.|2.6.28
[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 _0xc9d2=['FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','raw','then','update','options','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x186278,_0x592e41){var _0x256ce0=function(_0x29385e){while(--_0x29385e){_0x186278['push'](_0x186278['shift']());}};_0x256ce0(++_0x592e41);}(_0xc9d2,0x159));var _0x2c9d=function(_0x144aff,_0x5e638f){_0x144aff=_0x144aff-0x0;var _0x481d2a=_0xc9d2[_0x144aff];return _0x481d2a;};'use strict';var _=require(_0x2c9d('0x0'));var util=require(_0x2c9d('0x1'));var moment=require(_0x2c9d('0x2'));var BPromise=require(_0x2c9d('0x3'));var rs=require(_0x2c9d('0x4'));var fs=require('fs');var Redis=require(_0x2c9d('0x5'));var db=require(_0x2c9d('0x6'))['db'];var utils=require(_0x2c9d('0x7'));var logger=require(_0x2c9d('0x8'))(_0x2c9d('0x9'));var config=require(_0x2c9d('0xa'));var jayson=require(_0x2c9d('0xb'));var client=jayson['client'][_0x2c9d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x256590,_0x11474a,_0x378601){return new BPromise(function(_0x1d805e,_0xb51ebf){return client[_0x2c9d('0xd')](_0x256590,_0x378601)['then'](function(_0x10ec57){logger[_0x2c9d('0xe')](_0x2c9d('0xf'),_0x11474a,_0x2c9d('0x10'));logger[_0x2c9d('0x11')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x11474a,_0x2c9d('0x10'),JSON[_0x2c9d('0x12')](_0x10ec57));if(_0x10ec57['error']){if(_0x10ec57[_0x2c9d('0x13')][_0x2c9d('0x14')]===0x1f4){logger[_0x2c9d('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x11474a,_0x10ec57[_0x2c9d('0x13')][_0x2c9d('0x15')]);return _0xb51ebf(_0x10ec57[_0x2c9d('0x13')][_0x2c9d('0x15')]);}logger['error'](_0x2c9d('0xf'),_0x11474a,_0x10ec57[_0x2c9d('0x13')][_0x2c9d('0x15')]);return _0x1d805e(_0x10ec57[_0x2c9d('0x13')]['message']);}else{logger[_0x2c9d('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x11474a,_0x2c9d('0x10'));_0x1d805e(_0x10ec57[_0x2c9d('0x16')]['message']);}})[_0x2c9d('0x17')](function(_0xd91020){logger['error'](_0x2c9d('0xf'),_0x11474a,_0xd91020);_0xb51ebf(_0xd91020);});});}exports[_0x2c9d('0x18')]=function(_0x2bd4bb){var _0x23c91a=this;return new Promise(function(_0x284b05,_0x3b5f11){return db[_0x2c9d('0x19')][_0x2c9d('0x1a')](_0x2bd4bb[_0x2c9d('0x1b')],{'raw':_0x2bd4bb['options']?_0x2bd4bb['options'][_0x2c9d('0x1c')]===undefined?!![]:![]:!![]})[_0x2c9d('0x1d')](function(_0x4d5997){logger[_0x2c9d('0xe')](_0x2c9d('0x18'),_0x2bd4bb);logger[_0x2c9d('0x11')](_0x2c9d('0x18'),_0x2bd4bb,JSON['stringify'](_0x4d5997));_0x284b05(_0x4d5997);})[_0x2c9d('0x17')](function(_0xc33406){logger['error'](_0x2c9d('0x18'),_0xc33406['message'],_0x2bd4bb);_0x3b5f11(_0x23c91a[_0x2c9d('0x13')](0x1f4,_0xc33406['message']));});});};exports['UpdateFaxQueueReport']=function(_0x68f7d2){var _0x3b7e5c=this;return new Promise(function(_0x670b6f,_0x5a5ac5){return db[_0x2c9d('0x19')][_0x2c9d('0x1e')](_0x68f7d2[_0x2c9d('0x1b')],{'raw':_0x68f7d2['options']?_0x68f7d2[_0x2c9d('0x1f')][_0x2c9d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x68f7d2[_0x2c9d('0x1f')]?_0x68f7d2[_0x2c9d('0x1f')][_0x2c9d('0x20')]||null:null,'attributes':_0x68f7d2[_0x2c9d('0x1f')]?_0x68f7d2[_0x2c9d('0x1f')][_0x2c9d('0x21')]||null:null,'limit':_0x68f7d2[_0x2c9d('0x1f')]?_0x68f7d2[_0x2c9d('0x1f')][_0x2c9d('0x22')]||null:null})[_0x2c9d('0x1d')](function(_0x23c912){logger['info'](_0x2c9d('0x23'),_0x68f7d2);logger[_0x2c9d('0x11')](_0x2c9d('0x23'),_0x68f7d2,JSON[_0x2c9d('0x12')](_0x23c912));_0x670b6f(_0x23c912);})[_0x2c9d('0x17')](function(_0xaf3a60){logger['error'](_0x2c9d('0x23'),_0xaf3a60[_0x2c9d('0x15')],_0x68f7d2);_0x5a5ac5(_0x3b7e5c[_0x2c9d('0x13')](0x1f4,_0xaf3a60['message']));});});};