0b1230fdd1cdd493fb2c8417b8a9bdbf0e408a59
[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 _0xac26=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','then','UpdateFaxQueueReport'];(function(_0x19a5d8,_0x347207){var _0x30104a=function(_0x292695){while(--_0x292695){_0x19a5d8['push'](_0x19a5d8['shift']());}};_0x30104a(++_0x347207);}(_0xac26,0xa1));var _0x6ac2=function(_0x1e22f7,_0x7fd032){_0x1e22f7=_0x1e22f7-0x0;var _0x18bb55=_0xac26[_0x1e22f7];return _0x18bb55;};'use strict';var _=require(_0x6ac2('0x0'));var util=require(_0x6ac2('0x1'));var moment=require(_0x6ac2('0x2'));var BPromise=require(_0x6ac2('0x3'));var rs=require(_0x6ac2('0x4'));var fs=require('fs');var Redis=require(_0x6ac2('0x5'));var db=require(_0x6ac2('0x6'))['db'];var utils=require(_0x6ac2('0x7'));var logger=require(_0x6ac2('0x8'))(_0x6ac2('0x9'));var config=require(_0x6ac2('0xa'));var jayson=require(_0x6ac2('0xb'));var client=jayson[_0x6ac2('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b7e6,_0x38de2b,_0x3286df){return new BPromise(function(_0x5a5eae,_0x1b1ad4){return client[_0x6ac2('0xd')](_0x27b7e6,_0x3286df)['then'](function(_0x2e7183){logger[_0x6ac2('0xe')](_0x6ac2('0xf'),_0x38de2b,'request\x20sent');logger[_0x6ac2('0x10')](_0x6ac2('0x11'),_0x38de2b,'request\x20sent',JSON[_0x6ac2('0x12')](_0x2e7183));if(_0x2e7183[_0x6ac2('0x13')]){if(_0x2e7183[_0x6ac2('0x13')][_0x6ac2('0x14')]===0x1f4){logger[_0x6ac2('0x13')](_0x6ac2('0xf'),_0x38de2b,_0x2e7183['error'][_0x6ac2('0x15')]);return _0x1b1ad4(_0x2e7183[_0x6ac2('0x13')][_0x6ac2('0x15')]);}logger['error'](_0x6ac2('0xf'),_0x38de2b,_0x2e7183['error'][_0x6ac2('0x15')]);return _0x5a5eae(_0x2e7183[_0x6ac2('0x13')][_0x6ac2('0x15')]);}else{logger[_0x6ac2('0xe')](_0x6ac2('0xf'),_0x38de2b,_0x6ac2('0x16'));_0x5a5eae(_0x2e7183['result'][_0x6ac2('0x15')]);}})[_0x6ac2('0x17')](function(_0x1936cf){logger[_0x6ac2('0x13')](_0x6ac2('0xf'),_0x38de2b,_0x1936cf);_0x1b1ad4(_0x1936cf);});});}exports[_0x6ac2('0x18')]=function(_0x5b159e){var _0x2c1292=this;return new Promise(function(_0x101a2e,_0x98fca7){return db[_0x6ac2('0x19')][_0x6ac2('0x1a')](_0x5b159e['body'],{'raw':_0x5b159e[_0x6ac2('0x1b')]?_0x5b159e[_0x6ac2('0x1b')][_0x6ac2('0x1c')]===undefined?!![]:![]:!![]})[_0x6ac2('0x1d')](function(_0x235786){logger[_0x6ac2('0xe')](_0x6ac2('0x18'),_0x5b159e);logger[_0x6ac2('0x10')](_0x6ac2('0x18'),_0x5b159e,JSON[_0x6ac2('0x12')](_0x235786));_0x101a2e(_0x235786);})[_0x6ac2('0x17')](function(_0x9ec9b8){logger[_0x6ac2('0x13')](_0x6ac2('0x18'),_0x9ec9b8[_0x6ac2('0x15')],_0x5b159e);_0x98fca7(_0x2c1292['error'](0x1f4,_0x9ec9b8[_0x6ac2('0x15')]));});});};exports[_0x6ac2('0x1e')]=function(_0x3d352b){var _0x12c395=this;return new Promise(function(_0x22afbc,_0x5972d9){return db['FaxQueueReport']['update'](_0x3d352b['body'],{'raw':_0x3d352b['options']?_0x3d352b[_0x6ac2('0x1b')][_0x6ac2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d352b[_0x6ac2('0x1b')]?_0x3d352b[_0x6ac2('0x1b')]['where']||null:null,'attributes':_0x3d352b['options']?_0x3d352b[_0x6ac2('0x1b')]['attributes']||null:null,'limit':_0x3d352b[_0x6ac2('0x1b')]?_0x3d352b[_0x6ac2('0x1b')][_0x6ac2('0x1f')]||null:null})[_0x6ac2('0x1d')](function(_0x17cf5e){logger[_0x6ac2('0xe')](_0x6ac2('0x1e'),_0x3d352b);logger[_0x6ac2('0x10')](_0x6ac2('0x1e'),_0x3d352b,JSON[_0x6ac2('0x12')](_0x17cf5e));_0x22afbc(_0x17cf5e);})['catch'](function(_0x5952af){logger['error'](_0x6ac2('0x1e'),_0x5952af['message'],_0x3d352b);_0x5972d9(_0x12c395['error'](0x1f4,_0x5952af[_0x6ac2('0x15')]));});});};