Built motion from commit da617fac.|2.6.6
[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 _0xd96d=['result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','then','UpdateFaxQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../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','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd96d,0x16c));var _0xdd96=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xd96d[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xdd96('0x0'));var util=require(_0xdd96('0x1'));var moment=require(_0xdd96('0x2'));var BPromise=require(_0xdd96('0x3'));var rs=require(_0xdd96('0x4'));var fs=require('fs');var Redis=require(_0xdd96('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd96('0x6'));var logger=require(_0xdd96('0x7'))('rpc');var config=require(_0xdd96('0x8'));var jayson=require(_0xdd96('0x9'));var client=jayson[_0xdd96('0xa')][_0xdd96('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e921d,_0x2b9c06,_0x257fe0){return new BPromise(function(_0x3d3768,_0x4a2492){return client[_0xdd96('0xc')](_0x3e921d,_0x257fe0)['then'](function(_0xca153){logger[_0xdd96('0xd')](_0xdd96('0xe'),_0x2b9c06,_0xdd96('0xf'));logger[_0xdd96('0x10')](_0xdd96('0x11'),_0x2b9c06,_0xdd96('0xf'),JSON[_0xdd96('0x12')](_0xca153));if(_0xca153[_0xdd96('0x13')]){if(_0xca153[_0xdd96('0x13')]['code']===0x1f4){logger[_0xdd96('0x13')](_0xdd96('0xe'),_0x2b9c06,_0xca153[_0xdd96('0x13')][_0xdd96('0x14')]);return _0x4a2492(_0xca153[_0xdd96('0x13')][_0xdd96('0x14')]);}logger[_0xdd96('0x13')](_0xdd96('0xe'),_0x2b9c06,_0xca153['error']['message']);return _0x3d3768(_0xca153[_0xdd96('0x13')][_0xdd96('0x14')]);}else{logger[_0xdd96('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x2b9c06,'request\x20sent');_0x3d3768(_0xca153[_0xdd96('0x15')][_0xdd96('0x14')]);}})[_0xdd96('0x16')](function(_0x248916){logger['error'](_0xdd96('0xe'),_0x2b9c06,_0x248916);_0x4a2492(_0x248916);});});}exports[_0xdd96('0x17')]=function(_0x229820){var _0x3e5a69=this;return new Promise(function(_0xf54a09,_0x3bd0d8){return db[_0xdd96('0x18')][_0xdd96('0x19')](_0x229820[_0xdd96('0x1a')],{'raw':_0x229820[_0xdd96('0x1b')]?_0x229820[_0xdd96('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xdd96('0x1c')](function(_0x58f6ef){logger[_0xdd96('0xd')]('CreateFaxQueueReport',_0x229820);logger['debug'](_0xdd96('0x17'),_0x229820,JSON[_0xdd96('0x12')](_0x58f6ef));_0xf54a09(_0x58f6ef);})[_0xdd96('0x16')](function(_0x397d64){logger[_0xdd96('0x13')]('CreateFaxQueueReport',_0x397d64[_0xdd96('0x14')],_0x229820);_0x3bd0d8(_0x3e5a69[_0xdd96('0x13')](0x1f4,_0x397d64[_0xdd96('0x14')]));});});};exports[_0xdd96('0x1d')]=function(_0x4db789){var _0x227836=this;return new Promise(function(_0x3823a0,_0x4ea6f9){return db['FaxQueueReport'][_0xdd96('0x1e')](_0x4db789[_0xdd96('0x1a')],{'raw':_0x4db789[_0xdd96('0x1b')]?_0x4db789[_0xdd96('0x1b')][_0xdd96('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4db789[_0xdd96('0x1b')]?_0x4db789[_0xdd96('0x1b')][_0xdd96('0x20')]||null:null,'attributes':_0x4db789[_0xdd96('0x1b')]?_0x4db789['options'][_0xdd96('0x21')]||null:null,'limit':_0x4db789[_0xdd96('0x1b')]?_0x4db789['options'][_0xdd96('0x22')]||null:null})['then'](function(_0x1904ee){logger[_0xdd96('0xd')]('UpdateFaxQueueReport',_0x4db789);logger[_0xdd96('0x10')](_0xdd96('0x1d'),_0x4db789,JSON[_0xdd96('0x12')](_0x1904ee));_0x3823a0(_0x1904ee);})[_0xdd96('0x16')](function(_0x172aef){logger[_0xdd96('0x13')](_0xdd96('0x1d'),_0x172aef['message'],_0x4db789);_0x4ea6f9(_0x227836['error'](0x1f4,_0x172aef[_0xdd96('0x14')]));});});};