Built motion from commit (unavailable).|2.5.4
[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 _0x61f9=['stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','options','update','body','raw','where','limit','UpdateFaxQueueReport','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2fb474,_0x435c06){var _0x141eb4=function(_0x59321e){while(--_0x59321e){_0x2fb474['push'](_0x2fb474['shift']());}};_0x141eb4(++_0x435c06);}(_0x61f9,0x107));var _0x961f=function(_0x1efe29,_0x5cef11){_0x1efe29=_0x1efe29-0x0;var _0x4d2ba1=_0x61f9[_0x1efe29];return _0x4d2ba1;};'use strict';var _=require(_0x961f('0x0'));var util=require(_0x961f('0x1'));var moment=require(_0x961f('0x2'));var BPromise=require('bluebird');var rs=require(_0x961f('0x3'));var fs=require('fs');var Redis=require(_0x961f('0x4'));var db=require(_0x961f('0x5'))['db'];var utils=require(_0x961f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x961f('0x7'));var jayson=require(_0x961f('0x8'));var client=jayson[_0x961f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10e958,_0x15dc2b,_0x34ab48){return new BPromise(function(_0x2766ed,_0x4b4b41){return client[_0x961f('0xa')](_0x10e958,_0x34ab48)[_0x961f('0xb')](function(_0x3841f8){logger[_0x961f('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x15dc2b,'request\x20sent');logger[_0x961f('0xd')](_0x961f('0xe'),_0x15dc2b,_0x961f('0xf'),JSON[_0x961f('0x10')](_0x3841f8));if(_0x3841f8[_0x961f('0x11')]){if(_0x3841f8['error']['code']===0x1f4){logger[_0x961f('0x11')](_0x961f('0x12'),_0x15dc2b,_0x3841f8[_0x961f('0x11')][_0x961f('0x13')]);return _0x4b4b41(_0x3841f8[_0x961f('0x11')]['message']);}logger[_0x961f('0x11')](_0x961f('0x12'),_0x15dc2b,_0x3841f8[_0x961f('0x11')][_0x961f('0x13')]);return _0x2766ed(_0x3841f8[_0x961f('0x11')][_0x961f('0x13')]);}else{logger['info'](_0x961f('0x12'),_0x15dc2b,'request\x20sent');_0x2766ed(_0x3841f8[_0x961f('0x14')][_0x961f('0x13')]);}})['catch'](function(_0x56c3bf){logger['error'](_0x961f('0x12'),_0x15dc2b,_0x56c3bf);_0x4b4b41(_0x56c3bf);});});}exports[_0x961f('0x15')]=function(_0x2f1d94){var _0x2d0d0e=this;return new Promise(function(_0xb27495,_0x348a1c){return db[_0x961f('0x16')]['create'](_0x2f1d94['body'],{'raw':_0x2f1d94['options']?_0x2f1d94[_0x961f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x961f('0xb')](function(_0x206197){logger[_0x961f('0xc')]('CreateFaxQueueReport',_0x2f1d94);logger[_0x961f('0xd')]('CreateFaxQueueReport',_0x2f1d94,JSON['stringify'](_0x206197));_0xb27495(_0x206197);})['catch'](function(_0x1c661f){logger[_0x961f('0x11')](_0x961f('0x15'),_0x1c661f['message'],_0x2f1d94);_0x348a1c(_0x2d0d0e[_0x961f('0x11')](0x1f4,_0x1c661f['message']));});});};exports['UpdateFaxQueueReport']=function(_0x52bc76){var _0x27e6b9=this;return new Promise(function(_0x4b7c6e,_0x16d2b3){return db[_0x961f('0x16')][_0x961f('0x18')](_0x52bc76[_0x961f('0x19')],{'raw':_0x52bc76[_0x961f('0x17')]?_0x52bc76[_0x961f('0x17')][_0x961f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52bc76[_0x961f('0x17')]?_0x52bc76[_0x961f('0x17')][_0x961f('0x1b')]||null:null,'attributes':_0x52bc76[_0x961f('0x17')]?_0x52bc76['options']['attributes']||null:null,'limit':_0x52bc76[_0x961f('0x17')]?_0x52bc76[_0x961f('0x17')][_0x961f('0x1c')]||null:null})[_0x961f('0xb')](function(_0x130512){logger[_0x961f('0xc')](_0x961f('0x1d'),_0x52bc76);logger[_0x961f('0xd')](_0x961f('0x1d'),_0x52bc76,JSON[_0x961f('0x10')](_0x130512));_0x4b7c6e(_0x130512);})[_0x961f('0x1e')](function(_0x2905b6){logger[_0x961f('0x11')](_0x961f('0x1d'),_0x2905b6[_0x961f('0x13')],_0x52bc76);_0x16d2b3(_0x27e6b9[_0x961f('0x11')](0x1f4,_0x2905b6[_0x961f('0x13')]));});});};