Built motion from commit 511216ff.|2.6.34
[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 _0x2c9f=['SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','UpdateSmsQueueReport','where','attributes','limit','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SmsQueueReport,\x20%s,\x20%s','debug'];(function(_0x23193b,_0x248447){var _0x5cf7ff=function(_0x507286){while(--_0x507286){_0x23193b['push'](_0x23193b['shift']());}};_0x5cf7ff(++_0x248447);}(_0x2c9f,0x1ee));var _0xf2c9=function(_0x2b048f,_0x592b9a){_0x2b048f=_0x2b048f-0x0;var _0x5208b0=_0x2c9f[_0x2b048f];return _0x5208b0;};'use strict';var _=require(_0xf2c9('0x0'));var util=require('util');var moment=require(_0xf2c9('0x1'));var BPromise=require(_0xf2c9('0x2'));var rs=require(_0xf2c9('0x3'));var fs=require('fs');var Redis=require(_0xf2c9('0x4'));var db=require(_0xf2c9('0x5'))['db'];var utils=require(_0xf2c9('0x6'));var logger=require(_0xf2c9('0x7'))(_0xf2c9('0x8'));var config=require(_0xf2c9('0x9'));var jayson=require(_0xf2c9('0xa'));var client=jayson['client'][_0xf2c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d6f61,_0x4b431a,_0x32a728){return new BPromise(function(_0x10f472,_0x51531e){return client[_0xf2c9('0xc')](_0x5d6f61,_0x32a728)[_0xf2c9('0xd')](function(_0x76e982){logger['info'](_0xf2c9('0xe'),_0x4b431a,'request\x20sent');logger[_0xf2c9('0xf')](_0xf2c9('0x10'),_0x4b431a,_0xf2c9('0x11'),JSON[_0xf2c9('0x12')](_0x76e982));if(_0x76e982[_0xf2c9('0x13')]){if(_0x76e982['error'][_0xf2c9('0x14')]===0x1f4){logger[_0xf2c9('0x13')](_0xf2c9('0xe'),_0x4b431a,_0x76e982['error'][_0xf2c9('0x15')]);return _0x51531e(_0x76e982[_0xf2c9('0x13')][_0xf2c9('0x15')]);}logger[_0xf2c9('0x13')](_0xf2c9('0xe'),_0x4b431a,_0x76e982[_0xf2c9('0x13')][_0xf2c9('0x15')]);return _0x10f472(_0x76e982[_0xf2c9('0x13')][_0xf2c9('0x15')]);}else{logger['info'](_0xf2c9('0xe'),_0x4b431a,_0xf2c9('0x11'));_0x10f472(_0x76e982[_0xf2c9('0x16')][_0xf2c9('0x15')]);}})[_0xf2c9('0x17')](function(_0x5defb8){logger[_0xf2c9('0x13')](_0xf2c9('0xe'),_0x4b431a,_0x5defb8);_0x51531e(_0x5defb8);});});}exports[_0xf2c9('0x18')]=function(_0xaa644d){var _0x6f4db3=this;return new Promise(function(_0x158a34,_0x3f9ae6){return db[_0xf2c9('0x19')]['create'](_0xaa644d[_0xf2c9('0x1a')],{'raw':_0xaa644d['options']?_0xaa644d[_0xf2c9('0x1b')][_0xf2c9('0x1c')]===undefined?!![]:![]:!![]})[_0xf2c9('0xd')](function(_0x2e27ed){logger['info'](_0xf2c9('0x18'),_0xaa644d);logger['debug'](_0xf2c9('0x18'),_0xaa644d,JSON[_0xf2c9('0x12')](_0x2e27ed));_0x158a34(_0x2e27ed);})[_0xf2c9('0x17')](function(_0x18fee1){logger[_0xf2c9('0x13')](_0xf2c9('0x18'),_0x18fee1['message'],_0xaa644d);_0x3f9ae6(_0x6f4db3[_0xf2c9('0x13')](0x1f4,_0x18fee1[_0xf2c9('0x15')]));});});};exports[_0xf2c9('0x1d')]=function(_0x10349b){var _0xd7737f=this;return new Promise(function(_0x833108,_0x50ab65){return db[_0xf2c9('0x19')]['update'](_0x10349b['body'],{'raw':_0x10349b[_0xf2c9('0x1b')]?_0x10349b[_0xf2c9('0x1b')][_0xf2c9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10349b['options']?_0x10349b[_0xf2c9('0x1b')][_0xf2c9('0x1e')]||null:null,'attributes':_0x10349b['options']?_0x10349b[_0xf2c9('0x1b')][_0xf2c9('0x1f')]||null:null,'limit':_0x10349b[_0xf2c9('0x1b')]?_0x10349b[_0xf2c9('0x1b')][_0xf2c9('0x20')]||null:null})['then'](function(_0x467500){logger[_0xf2c9('0x21')](_0xf2c9('0x1d'),_0x10349b);logger[_0xf2c9('0xf')](_0xf2c9('0x1d'),_0x10349b,JSON[_0xf2c9('0x12')](_0x467500));_0x833108(_0x467500);})[_0xf2c9('0x17')](function(_0x172c4e){logger['error']('UpdateSmsQueueReport',_0x172c4e['message'],_0x10349b);_0x50ab65(_0xd7737f[_0xf2c9('0x13')](0x1f4,_0x172c4e['message']));});});};