7d7ac6e260617024fcc6392839e703dd541bd4ac
[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 _0xc8c5=['stringify','error','message','result','catch','create','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','body','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xc8c5,0x1eb));var _0x5c8c=function(_0x590455,_0x338a42){_0x590455=_0x590455-0x0;var _0x1b5a98=_0xc8c5[_0x590455];return _0x1b5a98;};'use strict';var _=require(_0x5c8c('0x0'));var util=require(_0x5c8c('0x1'));var moment=require(_0x5c8c('0x2'));var BPromise=require(_0x5c8c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c8c('0x4'));var db=require(_0x5c8c('0x5'))['db'];var utils=require(_0x5c8c('0x6'));var logger=require(_0x5c8c('0x7'))(_0x5c8c('0x8'));var config=require(_0x5c8c('0x9'));var jayson=require(_0x5c8c('0xa'));var client=jayson['client'][_0x5c8c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x417230,_0x1f5e72,_0x21ffa4){return new BPromise(function(_0x14ab2a,_0xe3e238){return client[_0x5c8c('0xc')](_0x417230,_0x21ffa4)[_0x5c8c('0xd')](function(_0x246413){logger[_0x5c8c('0xe')](_0x5c8c('0xf'),_0x1f5e72,_0x5c8c('0x10'));logger[_0x5c8c('0x11')](_0x5c8c('0x12'),_0x1f5e72,_0x5c8c('0x10'),JSON[_0x5c8c('0x13')](_0x246413));if(_0x246413['error']){if(_0x246413[_0x5c8c('0x14')]['code']===0x1f4){logger[_0x5c8c('0x14')](_0x5c8c('0xf'),_0x1f5e72,_0x246413[_0x5c8c('0x14')][_0x5c8c('0x15')]);return _0xe3e238(_0x246413['error'][_0x5c8c('0x15')]);}logger['error'](_0x5c8c('0xf'),_0x1f5e72,_0x246413[_0x5c8c('0x14')][_0x5c8c('0x15')]);return _0x14ab2a(_0x246413['error']['message']);}else{logger[_0x5c8c('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x1f5e72,_0x5c8c('0x10'));_0x14ab2a(_0x246413[_0x5c8c('0x16')][_0x5c8c('0x15')]);}})[_0x5c8c('0x17')](function(_0x460aed){logger['error'](_0x5c8c('0xf'),_0x1f5e72,_0x460aed);_0xe3e238(_0x460aed);});});}exports['CreateFaxQueueReport']=function(_0xeb9da2){var _0x426e1b=this;return new Promise(function(_0x10627e,_0x66c0a0){return db['FaxQueueReport'][_0x5c8c('0x18')](_0xeb9da2['body'],{'raw':_0xeb9da2[_0x5c8c('0x19')]?_0xeb9da2['options'][_0x5c8c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2093e2){logger[_0x5c8c('0xe')](_0x5c8c('0x1b'),_0xeb9da2);logger[_0x5c8c('0x11')](_0x5c8c('0x1b'),_0xeb9da2,JSON[_0x5c8c('0x13')](_0x2093e2));_0x10627e(_0x2093e2);})[_0x5c8c('0x17')](function(_0x19e5f1){logger[_0x5c8c('0x14')]('CreateFaxQueueReport',_0x19e5f1[_0x5c8c('0x15')],_0xeb9da2);_0x66c0a0(_0x426e1b[_0x5c8c('0x14')](0x1f4,_0x19e5f1[_0x5c8c('0x15')]));});});};exports[_0x5c8c('0x1c')]=function(_0x420a46){var _0xa0f8d5=this;return new Promise(function(_0x369d52,_0x39af51){return db['FaxQueueReport']['update'](_0x420a46[_0x5c8c('0x1d')],{'raw':_0x420a46[_0x5c8c('0x19')]?_0x420a46[_0x5c8c('0x19')][_0x5c8c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x420a46[_0x5c8c('0x19')]?_0x420a46[_0x5c8c('0x19')]['where']||null:null,'attributes':_0x420a46[_0x5c8c('0x19')]?_0x420a46[_0x5c8c('0x19')]['attributes']||null:null,'limit':_0x420a46[_0x5c8c('0x19')]?_0x420a46[_0x5c8c('0x19')]['limit']||null:null})['then'](function(_0x2b5747){logger[_0x5c8c('0xe')](_0x5c8c('0x1c'),_0x420a46);logger['debug'](_0x5c8c('0x1c'),_0x420a46,JSON[_0x5c8c('0x13')](_0x2b5747));_0x369d52(_0x2b5747);})[_0x5c8c('0x17')](function(_0x368dc6){logger[_0x5c8c('0x14')](_0x5c8c('0x1c'),_0x368dc6[_0x5c8c('0x15')],_0x420a46);_0x39af51(_0xa0f8d5[_0x5c8c('0x14')](0x1f4,_0x368dc6['message']));});});};