Built motion from commit eddce310.|2.6.12
[motion2.git] / server / api / smsQueueReport / smsQueueReport.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 _0x82c4=['stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','update','body','where','attributes','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x21ed53,_0x2b61af){var _0xcf4e54=function(_0x2ad1a7){while(--_0x2ad1a7){_0x21ed53['push'](_0x21ed53['shift']());}};_0xcf4e54(++_0x2b61af);}(_0x82c4,0xbe));var _0x482c=function(_0x318256,_0xa773f3){_0x318256=_0x318256-0x0;var _0xb1e352=_0x82c4[_0x318256];return _0xb1e352;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require(_0x482c('0x7'));var logger=require(_0x482c('0x8'))(_0x482c('0x9'));var config=require(_0x482c('0xa'));var jayson=require(_0x482c('0xb'));var client=jayson[_0x482c('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f1896,_0x1bedf6,_0x6ed5eb){return new BPromise(function(_0x7373d0,_0x5c9312){return client[_0x482c('0xd')](_0x4f1896,_0x6ed5eb)[_0x482c('0xe')](function(_0x2e3943){logger[_0x482c('0xf')](_0x482c('0x10'),_0x1bedf6,_0x482c('0x11'));logger[_0x482c('0x12')](_0x482c('0x13'),_0x1bedf6,_0x482c('0x11'),JSON[_0x482c('0x14')](_0x2e3943));if(_0x2e3943[_0x482c('0x15')]){if(_0x2e3943[_0x482c('0x15')]['code']===0x1f4){logger['error'](_0x482c('0x10'),_0x1bedf6,_0x2e3943['error'][_0x482c('0x16')]);return _0x5c9312(_0x2e3943['error'][_0x482c('0x16')]);}logger[_0x482c('0x15')](_0x482c('0x10'),_0x1bedf6,_0x2e3943[_0x482c('0x15')][_0x482c('0x16')]);return _0x7373d0(_0x2e3943[_0x482c('0x15')][_0x482c('0x16')]);}else{logger[_0x482c('0xf')](_0x482c('0x10'),_0x1bedf6,_0x482c('0x11'));_0x7373d0(_0x2e3943[_0x482c('0x17')][_0x482c('0x16')]);}})[_0x482c('0x18')](function(_0x3ebfb9){logger['error'](_0x482c('0x10'),_0x1bedf6,_0x3ebfb9);_0x5c9312(_0x3ebfb9);});});}exports[_0x482c('0x19')]=function(_0x4d41fc){var _0x4566f9=this;return new Promise(function(_0x4e6523,_0x27ffd4){return db[_0x482c('0x1a')][_0x482c('0x1b')](_0x4d41fc['body'],{'raw':_0x4d41fc[_0x482c('0x1c')]?_0x4d41fc[_0x482c('0x1c')][_0x482c('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x578028){logger[_0x482c('0xf')](_0x482c('0x19'),_0x4d41fc);logger[_0x482c('0x12')](_0x482c('0x19'),_0x4d41fc,JSON[_0x482c('0x14')](_0x578028));_0x4e6523(_0x578028);})['catch'](function(_0x2b0973){logger['error'](_0x482c('0x19'),_0x2b0973[_0x482c('0x16')],_0x4d41fc);_0x27ffd4(_0x4566f9[_0x482c('0x15')](0x1f4,_0x2b0973[_0x482c('0x16')]));});});};exports['UpdateSmsQueueReport']=function(_0xbddf93){var _0x16ed52=this;return new Promise(function(_0x53f9a9,_0x276bee){return db[_0x482c('0x1a')][_0x482c('0x1e')](_0xbddf93[_0x482c('0x1f')],{'raw':_0xbddf93[_0x482c('0x1c')]?_0xbddf93['options'][_0x482c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbddf93[_0x482c('0x1c')]?_0xbddf93['options'][_0x482c('0x20')]||null:null,'attributes':_0xbddf93[_0x482c('0x1c')]?_0xbddf93[_0x482c('0x1c')][_0x482c('0x21')]||null:null,'limit':_0xbddf93['options']?_0xbddf93[_0x482c('0x1c')]['limit']||null:null})[_0x482c('0xe')](function(_0xb540db){logger['info'](_0x482c('0x22'),_0xbddf93);logger[_0x482c('0x12')]('UpdateSmsQueueReport',_0xbddf93,JSON[_0x482c('0x14')](_0xb540db));_0x53f9a9(_0xb540db);})[_0x482c('0x18')](function(_0x52eb80){logger[_0x482c('0x15')](_0x482c('0x22'),_0x52eb80[_0x482c('0x16')],_0xbddf93);_0x276bee(_0x16ed52[_0x482c('0x15')](0x1f4,_0x52eb80['message']));});});};