Built motion from commit (unavailable).|2.4.21
[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 _0x9921=['../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','info','result','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x24428d,_0x3c7e73){var _0x3e1eec=function(_0x3a6d2a){while(--_0x3a6d2a){_0x24428d['push'](_0x24428d['shift']());}};_0x3e1eec(++_0x3c7e73);}(_0x9921,0xb4));var _0x1992=function(_0x2d4870,_0x4be0ed){_0x2d4870=_0x2d4870-0x0;var _0x4837f7=_0x9921[_0x2d4870];return _0x4837f7;};'use strict';var _=require(_0x1992('0x0'));var util=require(_0x1992('0x1'));var moment=require('moment');var BPromise=require(_0x1992('0x2'));var rs=require(_0x1992('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1992('0x4'))['db'];var utils=require(_0x1992('0x5'));var logger=require(_0x1992('0x6'))('rpc');var config=require(_0x1992('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1992('0x8')][_0x1992('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e0d24,_0x71f737,_0x150dec){return new BPromise(function(_0x25ad22,_0x1cda34){return client[_0x1992('0xa')](_0x4e0d24,_0x150dec)[_0x1992('0xb')](function(_0x306b2c){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x71f737,_0x1992('0xc'));logger[_0x1992('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x71f737,_0x1992('0xc'),JSON[_0x1992('0xe')](_0x306b2c));if(_0x306b2c[_0x1992('0xf')]){if(_0x306b2c[_0x1992('0xf')][_0x1992('0x10')]===0x1f4){logger[_0x1992('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x71f737,_0x306b2c[_0x1992('0xf')]['message']);return _0x1cda34(_0x306b2c[_0x1992('0xf')][_0x1992('0x11')]);}logger[_0x1992('0xf')](_0x1992('0x12'),_0x71f737,_0x306b2c[_0x1992('0xf')][_0x1992('0x11')]);return _0x25ad22(_0x306b2c[_0x1992('0xf')][_0x1992('0x11')]);}else{logger[_0x1992('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x71f737,_0x1992('0xc'));_0x25ad22(_0x306b2c[_0x1992('0x14')][_0x1992('0x11')]);}})['catch'](function(_0x32ee3e){logger[_0x1992('0xf')](_0x1992('0x12'),_0x71f737,_0x32ee3e);_0x1cda34(_0x32ee3e);});});}exports['CreateFaxQueueReport']=function(_0x9e92d7){var _0x52ddf1=this;return new Promise(function(_0x3a155c,_0x3706b6){return db['FaxQueueReport'][_0x1992('0x15')](_0x9e92d7[_0x1992('0x16')],{'raw':_0x9e92d7['options']?_0x9e92d7[_0x1992('0x17')][_0x1992('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xdb49ad){logger[_0x1992('0x13')](_0x1992('0x19'),_0x9e92d7);logger[_0x1992('0xd')](_0x1992('0x19'),_0x9e92d7,JSON[_0x1992('0xe')](_0xdb49ad));_0x3a155c(_0xdb49ad);})['catch'](function(_0x5893be){logger[_0x1992('0xf')](_0x1992('0x19'),_0x5893be[_0x1992('0x11')],_0x9e92d7);_0x3706b6(_0x52ddf1[_0x1992('0xf')](0x1f4,_0x5893be[_0x1992('0x11')]));});});};exports[_0x1992('0x1a')]=function(_0x1c0b17){var _0x519795=this;return new Promise(function(_0x4dbe2c,_0x1f8ab1){return db[_0x1992('0x1b')][_0x1992('0x1c')](_0x1c0b17['body'],{'raw':_0x1c0b17[_0x1992('0x17')]?_0x1c0b17[_0x1992('0x17')][_0x1992('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c0b17['options']?_0x1c0b17[_0x1992('0x17')][_0x1992('0x1d')]||null:null,'attributes':_0x1c0b17[_0x1992('0x17')]?_0x1c0b17[_0x1992('0x17')][_0x1992('0x1e')]||null:null,'limit':_0x1c0b17['options']?_0x1c0b17[_0x1992('0x17')]['limit']||null:null})[_0x1992('0xb')](function(_0x4fd027){logger[_0x1992('0x13')](_0x1992('0x1a'),_0x1c0b17);logger[_0x1992('0xd')](_0x1992('0x1a'),_0x1c0b17,JSON[_0x1992('0xe')](_0x4fd027));_0x4dbe2c(_0x4fd027);})['catch'](function(_0x3736cc){logger[_0x1992('0xf')]('UpdateFaxQueueReport',_0x3736cc[_0x1992('0x11')],_0x1c0b17);_0x1f8ab1(_0x519795[_0x1992('0xf')](0x1f4,_0x3736cc['message']));});});};