5bfb7867dac01e97e68e36eedb89adb163cc7e75
[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 _0xc432=['body','options','where','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','raw','stringify','UpdateFaxQueueReport','update'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0xc432,0xfc));var _0x2c43=function(_0x5ddd98,_0x5e54f5){_0x5ddd98=_0x5ddd98-0x0;var _0x9288b3=_0xc432[_0x5ddd98];return _0x9288b3;};'use strict';var _=require(_0x2c43('0x0'));var util=require(_0x2c43('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2c43('0x2'));var fs=require('fs');var Redis=require(_0x2c43('0x3'));var db=require(_0x2c43('0x4'))['db'];var utils=require(_0x2c43('0x5'));var logger=require(_0x2c43('0x6'))('rpc');var config=require(_0x2c43('0x7'));var jayson=require(_0x2c43('0x8'));var client=jayson[_0x2c43('0x9')][_0x2c43('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1db87e,_0x34c25a,_0x23f6eb){return new BPromise(function(_0x4c4886,_0x5ede78){return client['request'](_0x1db87e,_0x23f6eb)[_0x2c43('0xb')](function(_0xe5d158){logger[_0x2c43('0xc')](_0x2c43('0xd'),_0x34c25a,'request\x20sent');logger[_0x2c43('0xe')](_0x2c43('0xf'),_0x34c25a,_0x2c43('0x10'),JSON['stringify'](_0xe5d158));if(_0xe5d158[_0x2c43('0x11')]){if(_0xe5d158[_0x2c43('0x11')]['code']===0x1f4){logger['error'](_0x2c43('0xd'),_0x34c25a,_0xe5d158[_0x2c43('0x11')]['message']);return _0x5ede78(_0xe5d158['error'][_0x2c43('0x12')]);}logger[_0x2c43('0x11')](_0x2c43('0xd'),_0x34c25a,_0xe5d158[_0x2c43('0x11')][_0x2c43('0x12')]);return _0x4c4886(_0xe5d158[_0x2c43('0x11')][_0x2c43('0x12')]);}else{logger['info'](_0x2c43('0xd'),_0x34c25a,_0x2c43('0x10'));_0x4c4886(_0xe5d158[_0x2c43('0x13')][_0x2c43('0x12')]);}})[_0x2c43('0x14')](function(_0x1950d6){logger[_0x2c43('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x34c25a,_0x1950d6);_0x5ede78(_0x1950d6);});});}exports[_0x2c43('0x15')]=function(_0x53314d){var _0x32d8c5=this;return new Promise(function(_0x590266,_0x5e4138){return db[_0x2c43('0x16')]['create'](_0x53314d['body'],{'raw':_0x53314d['options']?_0x53314d['options'][_0x2c43('0x17')]===undefined?!![]:![]:!![]})[_0x2c43('0xb')](function(_0x523ecc){logger['info']('CreateFaxQueueReport',_0x53314d);logger['debug'](_0x2c43('0x15'),_0x53314d,JSON[_0x2c43('0x18')](_0x523ecc));_0x590266(_0x523ecc);})[_0x2c43('0x14')](function(_0x5b4d6c){logger[_0x2c43('0x11')]('CreateFaxQueueReport',_0x5b4d6c[_0x2c43('0x12')],_0x53314d);_0x5e4138(_0x32d8c5[_0x2c43('0x11')](0x1f4,_0x5b4d6c[_0x2c43('0x12')]));});});};exports[_0x2c43('0x19')]=function(_0xa9310b){var _0x926e0b=this;return new Promise(function(_0x5b9dc3,_0x591696){return db['FaxQueueReport'][_0x2c43('0x1a')](_0xa9310b[_0x2c43('0x1b')],{'raw':_0xa9310b[_0x2c43('0x1c')]?_0xa9310b[_0x2c43('0x1c')][_0x2c43('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa9310b[_0x2c43('0x1c')]?_0xa9310b['options'][_0x2c43('0x1d')]||null:null,'attributes':_0xa9310b['options']?_0xa9310b['options']['attributes']||null:null,'limit':_0xa9310b[_0x2c43('0x1c')]?_0xa9310b['options'][_0x2c43('0x1e')]||null:null})['then'](function(_0x5820ca){logger[_0x2c43('0xc')](_0x2c43('0x19'),_0xa9310b);logger[_0x2c43('0xe')](_0x2c43('0x19'),_0xa9310b,JSON[_0x2c43('0x18')](_0x5820ca));_0x5b9dc3(_0x5820ca);})[_0x2c43('0x14')](function(_0x329f82){logger[_0x2c43('0x11')](_0x2c43('0x19'),_0x329f82[_0x2c43('0x12')],_0xa9310b);_0x591696(_0x926e0b[_0x2c43('0x11')](0x1f4,_0x329f82['message']));});});};