Built motion from commit (unavailable).|2.4.17
[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 _0xb7d4=['options','raw','CreateFaxQueueReport','debug','UpdateFaxQueueReport','update','attributes','limit','then','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxQueueReport','create','body'];(function(_0x290181,_0x46db3e){var _0x2dc9dc=function(_0x1f08d6){while(--_0x1f08d6){_0x290181['push'](_0x290181['shift']());}};_0x2dc9dc(++_0x46db3e);}(_0xb7d4,0x19c));var _0x4b7d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb7d4[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0x4b7d('0x0'));var moment=require(_0x4b7d('0x1'));var BPromise=require(_0x4b7d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b7d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b7d('0x4'));var logger=require(_0x4b7d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4b7d('0x6'));var client=jayson[_0x4b7d('0x7')][_0x4b7d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x473fe0,_0x318c73,_0x1edc7e){return new BPromise(function(_0x4605bc,_0x56f94c){return client[_0x4b7d('0x9')](_0x473fe0,_0x1edc7e)['then'](function(_0x58e3ab){logger[_0x4b7d('0xa')](_0x4b7d('0xb'),_0x318c73,_0x4b7d('0xc'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x318c73,_0x4b7d('0xc'),JSON[_0x4b7d('0xd')](_0x58e3ab));if(_0x58e3ab[_0x4b7d('0xe')]){if(_0x58e3ab[_0x4b7d('0xe')][_0x4b7d('0xf')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x318c73,_0x58e3ab[_0x4b7d('0xe')][_0x4b7d('0x10')]);return _0x56f94c(_0x58e3ab['error'][_0x4b7d('0x10')]);}logger[_0x4b7d('0xe')](_0x4b7d('0xb'),_0x318c73,_0x58e3ab[_0x4b7d('0xe')][_0x4b7d('0x10')]);return _0x4605bc(_0x58e3ab[_0x4b7d('0xe')][_0x4b7d('0x10')]);}else{logger[_0x4b7d('0xa')](_0x4b7d('0xb'),_0x318c73,_0x4b7d('0xc'));_0x4605bc(_0x58e3ab[_0x4b7d('0x11')][_0x4b7d('0x10')]);}})[_0x4b7d('0x12')](function(_0x54b043){logger['error'](_0x4b7d('0xb'),_0x318c73,_0x54b043);_0x56f94c(_0x54b043);});});}exports['CreateFaxQueueReport']=function(_0x2426b8){var _0x13f819=this;return new Promise(function(_0x1566b6,_0x119524){return db[_0x4b7d('0x13')][_0x4b7d('0x14')](_0x2426b8[_0x4b7d('0x15')],{'raw':_0x2426b8[_0x4b7d('0x16')]?_0x2426b8['options'][_0x4b7d('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1d00f7){logger[_0x4b7d('0xa')](_0x4b7d('0x18'),_0x2426b8);logger[_0x4b7d('0x19')](_0x4b7d('0x18'),_0x2426b8,JSON[_0x4b7d('0xd')](_0x1d00f7));_0x1566b6(_0x1d00f7);})['catch'](function(_0x445a35){logger[_0x4b7d('0xe')](_0x4b7d('0x18'),_0x445a35[_0x4b7d('0x10')],_0x2426b8);_0x119524(_0x13f819[_0x4b7d('0xe')](0x1f4,_0x445a35[_0x4b7d('0x10')]));});});};exports[_0x4b7d('0x1a')]=function(_0x6ed215){var _0x519117=this;return new Promise(function(_0x298121,_0x47f423){return db['FaxQueueReport'][_0x4b7d('0x1b')](_0x6ed215[_0x4b7d('0x15')],{'raw':_0x6ed215[_0x4b7d('0x16')]?_0x6ed215[_0x4b7d('0x16')][_0x4b7d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6ed215[_0x4b7d('0x16')]?_0x6ed215[_0x4b7d('0x16')]['where']||null:null,'attributes':_0x6ed215[_0x4b7d('0x16')]?_0x6ed215[_0x4b7d('0x16')][_0x4b7d('0x1c')]||null:null,'limit':_0x6ed215[_0x4b7d('0x16')]?_0x6ed215[_0x4b7d('0x16')][_0x4b7d('0x1d')]||null:null})[_0x4b7d('0x1e')](function(_0x541030){logger[_0x4b7d('0xa')](_0x4b7d('0x1a'),_0x6ed215);logger['debug'](_0x4b7d('0x1a'),_0x6ed215,JSON['stringify'](_0x541030));_0x298121(_0x541030);})['catch'](function(_0x300be3){logger[_0x4b7d('0xe')]('UpdateFaxQueueReport',_0x300be3[_0x4b7d('0x10')],_0x6ed215);_0x47f423(_0x519117['error'](0x1f4,_0x300be3[_0x4b7d('0x10')]));});});};