58158e9527dd37f1a45fbe942eae936df1f4cde7
[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 _0x373f=['stringify','error','code','message','info','result','FaxQueueReport','create','body','raw','CreateFaxQueueReport','catch','UpdateFaxQueueReport','update','options','where','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x373f,0x171));var _0xf373=function(_0x58f529,_0x4c17ef){_0x58f529=_0x58f529-0x0;var _0x33dfaf=_0x373f[_0x58f529];return _0x33dfaf;};'use strict';var _=require(_0xf373('0x0'));var util=require('util');var moment=require(_0xf373('0x1'));var BPromise=require('bluebird');var rs=require(_0xf373('0x2'));var fs=require('fs');var Redis=require(_0xf373('0x3'));var db=require(_0xf373('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf373('0x5'))('rpc');var config=require(_0xf373('0x6'));var jayson=require(_0xf373('0x7'));var client=jayson[_0xf373('0x8')][_0xf373('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27217b,_0x5d6389,_0x5b7033){return new BPromise(function(_0x3f26a8,_0x14dcd8){return client[_0xf373('0xa')](_0x27217b,_0x5b7033)[_0xf373('0xb')](function(_0x2c9216){logger['info'](_0xf373('0xc'),_0x5d6389,_0xf373('0xd'));logger['debug'](_0xf373('0xe'),_0x5d6389,'request\x20sent',JSON[_0xf373('0xf')](_0x2c9216));if(_0x2c9216[_0xf373('0x10')]){if(_0x2c9216[_0xf373('0x10')][_0xf373('0x11')]===0x1f4){logger[_0xf373('0x10')](_0xf373('0xc'),_0x5d6389,_0x2c9216[_0xf373('0x10')][_0xf373('0x12')]);return _0x14dcd8(_0x2c9216['error'][_0xf373('0x12')]);}logger[_0xf373('0x10')](_0xf373('0xc'),_0x5d6389,_0x2c9216[_0xf373('0x10')][_0xf373('0x12')]);return _0x3f26a8(_0x2c9216[_0xf373('0x10')][_0xf373('0x12')]);}else{logger[_0xf373('0x13')](_0xf373('0xc'),_0x5d6389,'request\x20sent');_0x3f26a8(_0x2c9216[_0xf373('0x14')][_0xf373('0x12')]);}})['catch'](function(_0x5ae2be){logger[_0xf373('0x10')](_0xf373('0xc'),_0x5d6389,_0x5ae2be);_0x14dcd8(_0x5ae2be);});});}exports['CreateFaxQueueReport']=function(_0x469182){var _0xbadaff=this;return new Promise(function(_0x1dc130,_0xdd2fbe){return db[_0xf373('0x15')][_0xf373('0x16')](_0x469182[_0xf373('0x17')],{'raw':_0x469182['options']?_0x469182['options'][_0xf373('0x18')]===undefined?!![]:![]:!![]})[_0xf373('0xb')](function(_0x5d60b9){logger[_0xf373('0x13')](_0xf373('0x19'),_0x469182);logger['debug'](_0xf373('0x19'),_0x469182,JSON[_0xf373('0xf')](_0x5d60b9));_0x1dc130(_0x5d60b9);})[_0xf373('0x1a')](function(_0x2bd7fd){logger[_0xf373('0x10')](_0xf373('0x19'),_0x2bd7fd[_0xf373('0x12')],_0x469182);_0xdd2fbe(_0xbadaff[_0xf373('0x10')](0x1f4,_0x2bd7fd[_0xf373('0x12')]));});});};exports[_0xf373('0x1b')]=function(_0x343d55){var _0x9ef4e1=this;return new Promise(function(_0x1430cc,_0x79e5dd){return db[_0xf373('0x15')][_0xf373('0x1c')](_0x343d55[_0xf373('0x17')],{'raw':_0x343d55[_0xf373('0x1d')]?_0x343d55[_0xf373('0x1d')][_0xf373('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x343d55[_0xf373('0x1d')]?_0x343d55[_0xf373('0x1d')][_0xf373('0x1e')]||null:null,'attributes':_0x343d55[_0xf373('0x1d')]?_0x343d55[_0xf373('0x1d')][_0xf373('0x1f')]||null:null,'limit':_0x343d55[_0xf373('0x1d')]?_0x343d55[_0xf373('0x1d')]['limit']||null:null})[_0xf373('0xb')](function(_0x3f8c2b){logger[_0xf373('0x13')](_0xf373('0x1b'),_0x343d55);logger['debug'](_0xf373('0x1b'),_0x343d55,JSON[_0xf373('0xf')](_0x3f8c2b));_0x1430cc(_0x3f8c2b);})[_0xf373('0x1a')](function(_0x253590){logger['error'](_0xf373('0x1b'),_0x253590[_0xf373('0x12')],_0x343d55);_0x79e5dd(_0x9ef4e1['error'](0x1f4,_0x253590[_0xf373('0x12')]));});});};