Built motion from commit 753c950e.|2.5.42
[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 _0xa4f4=['catch','CreateFaxQueueReport','body','options','then','UpdateFaxQueueReport','FaxQueueReport','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3fd108,_0x5d911f){var _0x4f943f=function(_0x12abdf){while(--_0x12abdf){_0x3fd108['push'](_0x3fd108['shift']());}};_0x4f943f(++_0x5d911f);}(_0xa4f4,0x1b7));var _0x4a4f=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xa4f4[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x4a4f('0x0'));var util=require(_0x4a4f('0x1'));var moment=require(_0x4a4f('0x2'));var BPromise=require(_0x4a4f('0x3'));var rs=require(_0x4a4f('0x4'));var fs=require('fs');var Redis=require(_0x4a4f('0x5'));var db=require(_0x4a4f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a4f('0x7'))('rpc');var config=require(_0x4a4f('0x8'));var jayson=require(_0x4a4f('0x9'));var client=jayson[_0x4a4f('0xa')][_0x4a4f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5da7ed,_0x5547ad,_0x2bec9a){return new BPromise(function(_0x53d6f8,_0x502498){return client[_0x4a4f('0xc')](_0x5da7ed,_0x2bec9a)['then'](function(_0xc4cafb){logger[_0x4a4f('0xd')](_0x4a4f('0xe'),_0x5547ad,_0x4a4f('0xf'));logger[_0x4a4f('0x10')](_0x4a4f('0x11'),_0x5547ad,_0x4a4f('0xf'),JSON[_0x4a4f('0x12')](_0xc4cafb));if(_0xc4cafb['error']){if(_0xc4cafb[_0x4a4f('0x13')][_0x4a4f('0x14')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x5547ad,_0xc4cafb['error']['message']);return _0x502498(_0xc4cafb[_0x4a4f('0x13')][_0x4a4f('0x15')]);}logger[_0x4a4f('0x13')](_0x4a4f('0xe'),_0x5547ad,_0xc4cafb[_0x4a4f('0x13')][_0x4a4f('0x15')]);return _0x53d6f8(_0xc4cafb[_0x4a4f('0x13')][_0x4a4f('0x15')]);}else{logger[_0x4a4f('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x5547ad,_0x4a4f('0xf'));_0x53d6f8(_0xc4cafb[_0x4a4f('0x16')][_0x4a4f('0x15')]);}})[_0x4a4f('0x17')](function(_0x31950e){logger[_0x4a4f('0x13')](_0x4a4f('0xe'),_0x5547ad,_0x31950e);_0x502498(_0x31950e);});});}exports[_0x4a4f('0x18')]=function(_0x2cfbab){var _0x42e9bf=this;return new Promise(function(_0x2b8fd2,_0x5b2c6a){return db['FaxQueueReport']['create'](_0x2cfbab[_0x4a4f('0x19')],{'raw':_0x2cfbab[_0x4a4f('0x1a')]?_0x2cfbab[_0x4a4f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x4a4f('0x1b')](function(_0x25b67a){logger[_0x4a4f('0xd')](_0x4a4f('0x18'),_0x2cfbab);logger[_0x4a4f('0x10')](_0x4a4f('0x18'),_0x2cfbab,JSON[_0x4a4f('0x12')](_0x25b67a));_0x2b8fd2(_0x25b67a);})[_0x4a4f('0x17')](function(_0x3588e1){logger['error'](_0x4a4f('0x18'),_0x3588e1[_0x4a4f('0x15')],_0x2cfbab);_0x5b2c6a(_0x42e9bf[_0x4a4f('0x13')](0x1f4,_0x3588e1['message']));});});};exports[_0x4a4f('0x1c')]=function(_0x3f8fda){var _0x50e2e2=this;return new Promise(function(_0x4f996e,_0x5ee10f){return db[_0x4a4f('0x1d')]['update'](_0x3f8fda[_0x4a4f('0x19')],{'raw':_0x3f8fda[_0x4a4f('0x1a')]?_0x3f8fda[_0x4a4f('0x1a')][_0x4a4f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f8fda[_0x4a4f('0x1a')]?_0x3f8fda['options'][_0x4a4f('0x1f')]||null:null,'attributes':_0x3f8fda[_0x4a4f('0x1a')]?_0x3f8fda[_0x4a4f('0x1a')]['attributes']||null:null,'limit':_0x3f8fda[_0x4a4f('0x1a')]?_0x3f8fda[_0x4a4f('0x1a')][_0x4a4f('0x20')]||null:null})[_0x4a4f('0x1b')](function(_0x39f070){logger[_0x4a4f('0xd')](_0x4a4f('0x1c'),_0x3f8fda);logger[_0x4a4f('0x10')]('UpdateFaxQueueReport',_0x3f8fda,JSON['stringify'](_0x39f070));_0x4f996e(_0x39f070);})[_0x4a4f('0x17')](function(_0x36ede3){logger['error'](_0x4a4f('0x1c'),_0x36ede3[_0x4a4f('0x15')],_0x3f8fda);_0x5ee10f(_0x50e2e2[_0x4a4f('0x13')](0x1f4,_0x36ede3[_0x4a4f('0x15')]));});});};