Built motion from commit 6a92c2cd.|2.6.29
[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 _0x31f9=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','SmsQueueReport','create','body','options','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','update','raw','where','attributes','limit','lodash','util'];(function(_0x5e1f24,_0x442000){var _0x53823d=function(_0x44f343){while(--_0x44f343){_0x5e1f24['push'](_0x5e1f24['shift']());}};_0x53823d(++_0x442000);}(_0x31f9,0x18a));var _0x931f=function(_0x7134b9,_0x377d33){_0x7134b9=_0x7134b9-0x0;var _0x2b44fd=_0x31f9[_0x7134b9];return _0x2b44fd;};'use strict';var _=require(_0x931f('0x0'));var util=require(_0x931f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x931f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x931f('0x3'));var logger=require(_0x931f('0x4'))(_0x931f('0x5'));var config=require(_0x931f('0x6'));var jayson=require(_0x931f('0x7'));var client=jayson['client'][_0x931f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b6852,_0x4ce373,_0x404dc9){return new BPromise(function(_0x5a7103,_0x556177){return client[_0x931f('0x9')](_0x5b6852,_0x404dc9)[_0x931f('0xa')](function(_0x21afe1){logger[_0x931f('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x4ce373,'request\x20sent');logger[_0x931f('0xc')](_0x931f('0xd'),_0x4ce373,_0x931f('0xe'),JSON['stringify'](_0x21afe1));if(_0x21afe1['error']){if(_0x21afe1[_0x931f('0xf')][_0x931f('0x10')]===0x1f4){logger[_0x931f('0xf')](_0x931f('0x11'),_0x4ce373,_0x21afe1[_0x931f('0xf')][_0x931f('0x12')]);return _0x556177(_0x21afe1[_0x931f('0xf')][_0x931f('0x12')]);}logger['error'](_0x931f('0x11'),_0x4ce373,_0x21afe1[_0x931f('0xf')][_0x931f('0x12')]);return _0x5a7103(_0x21afe1['error'][_0x931f('0x12')]);}else{logger[_0x931f('0xb')](_0x931f('0x11'),_0x4ce373,_0x931f('0xe'));_0x5a7103(_0x21afe1[_0x931f('0x13')][_0x931f('0x12')]);}})[_0x931f('0x14')](function(_0x1a35c0){logger[_0x931f('0xf')](_0x931f('0x11'),_0x4ce373,_0x1a35c0);_0x556177(_0x1a35c0);});});}exports['CreateSmsQueueReport']=function(_0x515b0a){var _0x19649c=this;return new Promise(function(_0xd618fb,_0x13dfc0){return db[_0x931f('0x15')][_0x931f('0x16')](_0x515b0a[_0x931f('0x17')],{'raw':_0x515b0a[_0x931f('0x18')]?_0x515b0a[_0x931f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x931f('0xa')](function(_0x56e453){logger[_0x931f('0xb')](_0x931f('0x19'),_0x515b0a);logger[_0x931f('0xc')]('CreateSmsQueueReport',_0x515b0a,JSON[_0x931f('0x1a')](_0x56e453));_0xd618fb(_0x56e453);})['catch'](function(_0x2d5492){logger['error'](_0x931f('0x19'),_0x2d5492[_0x931f('0x12')],_0x515b0a);_0x13dfc0(_0x19649c[_0x931f('0xf')](0x1f4,_0x2d5492[_0x931f('0x12')]));});});};exports[_0x931f('0x1b')]=function(_0x507e48){var _0x41680e=this;return new Promise(function(_0x59ef7c,_0x1e1449){return db['SmsQueueReport'][_0x931f('0x1c')](_0x507e48[_0x931f('0x17')],{'raw':_0x507e48[_0x931f('0x18')]?_0x507e48[_0x931f('0x18')][_0x931f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x507e48[_0x931f('0x18')]?_0x507e48[_0x931f('0x18')][_0x931f('0x1e')]||null:null,'attributes':_0x507e48[_0x931f('0x18')]?_0x507e48[_0x931f('0x18')][_0x931f('0x1f')]||null:null,'limit':_0x507e48[_0x931f('0x18')]?_0x507e48['options'][_0x931f('0x20')]||null:null})['then'](function(_0x5505d2){logger['info'](_0x931f('0x1b'),_0x507e48);logger[_0x931f('0xc')](_0x931f('0x1b'),_0x507e48,JSON['stringify'](_0x5505d2));_0x59ef7c(_0x5505d2);})[_0x931f('0x14')](function(_0x7e37ce){logger[_0x931f('0xf')]('UpdateSmsQueueReport',_0x7e37ce[_0x931f('0x12')],_0x507e48);_0x1e1449(_0x41680e[_0x931f('0xf')](0x1f4,_0x7e37ce[_0x931f('0x12')]));});});};