Built motion from commit efa66e19.|2.6.22
[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 _0x6fde=['info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0xc47f48,_0x57254a){var _0x5e4f71=function(_0x252225){while(--_0x252225){_0xc47f48['push'](_0xc47f48['shift']());}};_0x5e4f71(++_0x57254a);}(_0x6fde,0x1d6));var _0xe6fd=function(_0x458dcc,_0x2c3c3b){_0x458dcc=_0x458dcc-0x0;var _0x510bcf=_0x6fde[_0x458dcc];return _0x510bcf;};'use strict';var _=require(_0xe6fd('0x0'));var util=require(_0xe6fd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6fd('0x2'))['db'];var utils=require(_0xe6fd('0x3'));var logger=require(_0xe6fd('0x4'))(_0xe6fd('0x5'));var config=require('../../config/environment');var jayson=require(_0xe6fd('0x6'));var client=jayson[_0xe6fd('0x7')][_0xe6fd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4795e2,_0x22bf0d,_0x419b6d){return new BPromise(function(_0x4a0798,_0x29905b){return client['request'](_0x4795e2,_0x419b6d)[_0xe6fd('0x9')](function(_0x2b7857){logger[_0xe6fd('0xa')](_0xe6fd('0xb'),_0x22bf0d,_0xe6fd('0xc'));logger[_0xe6fd('0xd')](_0xe6fd('0xe'),_0x22bf0d,_0xe6fd('0xc'),JSON[_0xe6fd('0xf')](_0x2b7857));if(_0x2b7857[_0xe6fd('0x10')]){if(_0x2b7857[_0xe6fd('0x10')]['code']===0x1f4){logger['error'](_0xe6fd('0xb'),_0x22bf0d,_0x2b7857[_0xe6fd('0x10')][_0xe6fd('0x11')]);return _0x29905b(_0x2b7857[_0xe6fd('0x10')][_0xe6fd('0x11')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x22bf0d,_0x2b7857[_0xe6fd('0x10')][_0xe6fd('0x11')]);return _0x4a0798(_0x2b7857[_0xe6fd('0x10')]['message']);}else{logger['info'](_0xe6fd('0xb'),_0x22bf0d,_0xe6fd('0xc'));_0x4a0798(_0x2b7857[_0xe6fd('0x12')][_0xe6fd('0x11')]);}})[_0xe6fd('0x13')](function(_0x2466ef){logger[_0xe6fd('0x10')](_0xe6fd('0xb'),_0x22bf0d,_0x2466ef);_0x29905b(_0x2466ef);});});}exports[_0xe6fd('0x14')]=function(_0x366485){var _0x122b7e=this;return new Promise(function(_0x58dc62,_0x24ea1b){return db[_0xe6fd('0x15')]['create'](_0x366485[_0xe6fd('0x16')],{'raw':_0x366485[_0xe6fd('0x17')]?_0x366485[_0xe6fd('0x17')][_0xe6fd('0x18')]===undefined?!![]:![]:!![]})[_0xe6fd('0x9')](function(_0x2a3f7e){logger[_0xe6fd('0xa')](_0xe6fd('0x14'),_0x366485);logger[_0xe6fd('0xd')]('CreateFaxQueueReport',_0x366485,JSON[_0xe6fd('0xf')](_0x2a3f7e));_0x58dc62(_0x2a3f7e);})[_0xe6fd('0x13')](function(_0x87d8f3){logger['error'](_0xe6fd('0x14'),_0x87d8f3['message'],_0x366485);_0x24ea1b(_0x122b7e['error'](0x1f4,_0x87d8f3[_0xe6fd('0x11')]));});});};exports[_0xe6fd('0x19')]=function(_0xec6bf3){var _0x5912bc=this;return new Promise(function(_0x2f8e05,_0x598b72){return db[_0xe6fd('0x15')][_0xe6fd('0x1a')](_0xec6bf3[_0xe6fd('0x16')],{'raw':_0xec6bf3[_0xe6fd('0x17')]?_0xec6bf3[_0xe6fd('0x17')][_0xe6fd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xec6bf3[_0xe6fd('0x17')]?_0xec6bf3[_0xe6fd('0x17')][_0xe6fd('0x1b')]||null:null,'attributes':_0xec6bf3[_0xe6fd('0x17')]?_0xec6bf3['options'][_0xe6fd('0x1c')]||null:null,'limit':_0xec6bf3[_0xe6fd('0x17')]?_0xec6bf3['options'][_0xe6fd('0x1d')]||null:null})[_0xe6fd('0x9')](function(_0x3ab1a1){logger[_0xe6fd('0xa')](_0xe6fd('0x19'),_0xec6bf3);logger[_0xe6fd('0xd')](_0xe6fd('0x19'),_0xec6bf3,JSON[_0xe6fd('0xf')](_0x3ab1a1));_0x2f8e05(_0x3ab1a1);})['catch'](function(_0x3ba65b){logger[_0xe6fd('0x10')]('UpdateFaxQueueReport',_0x3ba65b[_0xe6fd('0x11')],_0xec6bf3);_0x598b72(_0x5912bc[_0xe6fd('0x10')](0x1f4,_0x3ba65b[_0xe6fd('0x11')]));});});};