Built motion from commit (unavailable).|2.5.4
[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 _0x6b3a=['raw','stringify','catch','UpdateSmsQueueReport','update','where','limit','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','body','options'];(function(_0x4d2157,_0x201cf1){var _0x172f80=function(_0x587167){while(--_0x587167){_0x4d2157['push'](_0x4d2157['shift']());}};_0x172f80(++_0x201cf1);}(_0x6b3a,0x1a8));var _0xa6b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b3a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa6b3('0x0'));var util=require(_0xa6b3('0x1'));var moment=require(_0xa6b3('0x2'));var BPromise=require('bluebird');var rs=require(_0xa6b3('0x3'));var fs=require('fs');var Redis=require(_0xa6b3('0x4'));var db=require(_0xa6b3('0x5'))['db'];var utils=require(_0xa6b3('0x6'));var logger=require(_0xa6b3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa6b3('0x8'));var client=jayson[_0xa6b3('0x9')][_0xa6b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47125f,_0x515fc1,_0xbe43d3){return new BPromise(function(_0x11b6fe,_0x2f5ef1){return client['request'](_0x47125f,_0xbe43d3)[_0xa6b3('0xb')](function(_0x36a257){logger[_0xa6b3('0xc')](_0xa6b3('0xd'),_0x515fc1,_0xa6b3('0xe'));logger['debug'](_0xa6b3('0xf'),_0x515fc1,'request\x20sent',JSON['stringify'](_0x36a257));if(_0x36a257[_0xa6b3('0x10')]){if(_0x36a257[_0xa6b3('0x10')][_0xa6b3('0x11')]===0x1f4){logger[_0xa6b3('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x515fc1,_0x36a257['error']['message']);return _0x2f5ef1(_0x36a257[_0xa6b3('0x10')]['message']);}logger[_0xa6b3('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x515fc1,_0x36a257[_0xa6b3('0x10')][_0xa6b3('0x12')]);return _0x11b6fe(_0x36a257[_0xa6b3('0x10')]['message']);}else{logger[_0xa6b3('0xc')](_0xa6b3('0xd'),_0x515fc1,_0xa6b3('0xe'));_0x11b6fe(_0x36a257[_0xa6b3('0x13')][_0xa6b3('0x12')]);}})['catch'](function(_0x9435f7){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x515fc1,_0x9435f7);_0x2f5ef1(_0x9435f7);});});}exports[_0xa6b3('0x14')]=function(_0x76326c){var _0x2d1c27=this;return new Promise(function(_0x53a45f,_0x57758c){return db[_0xa6b3('0x15')]['create'](_0x76326c[_0xa6b3('0x16')],{'raw':_0x76326c['options']?_0x76326c[_0xa6b3('0x17')][_0xa6b3('0x18')]===undefined?!![]:![]:!![]})[_0xa6b3('0xb')](function(_0xda23dd){logger[_0xa6b3('0xc')]('CreateSmsQueueReport',_0x76326c);logger['debug'](_0xa6b3('0x14'),_0x76326c,JSON[_0xa6b3('0x19')](_0xda23dd));_0x53a45f(_0xda23dd);})[_0xa6b3('0x1a')](function(_0x147784){logger[_0xa6b3('0x10')](_0xa6b3('0x14'),_0x147784[_0xa6b3('0x12')],_0x76326c);_0x57758c(_0x2d1c27['error'](0x1f4,_0x147784[_0xa6b3('0x12')]));});});};exports[_0xa6b3('0x1b')]=function(_0x225a84){var _0x21b5a0=this;return new Promise(function(_0x12c0f4,_0xaadf36){return db[_0xa6b3('0x15')][_0xa6b3('0x1c')](_0x225a84[_0xa6b3('0x16')],{'raw':_0x225a84[_0xa6b3('0x17')]?_0x225a84[_0xa6b3('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225a84['options']?_0x225a84[_0xa6b3('0x17')][_0xa6b3('0x1d')]||null:null,'attributes':_0x225a84['options']?_0x225a84[_0xa6b3('0x17')]['attributes']||null:null,'limit':_0x225a84[_0xa6b3('0x17')]?_0x225a84[_0xa6b3('0x17')][_0xa6b3('0x1e')]||null:null})['then'](function(_0xd2d72d){logger[_0xa6b3('0xc')]('UpdateSmsQueueReport',_0x225a84);logger[_0xa6b3('0x1f')](_0xa6b3('0x1b'),_0x225a84,JSON[_0xa6b3('0x19')](_0xd2d72d));_0x12c0f4(_0xd2d72d);})[_0xa6b3('0x1a')](function(_0x456ae3){logger[_0xa6b3('0x10')](_0xa6b3('0x1b'),_0x456ae3['message'],_0x225a84);_0xaadf36(_0x21b5a0[_0xa6b3('0x10')](0x1f4,_0x456ae3['message']));});});};