Built motion from commit (unavailable).|2.4.21
[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 _0xadf4=['SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','debug'];(function(_0x3cb07a,_0x1749c5){var _0x35338f=function(_0x976ccb){while(--_0x976ccb){_0x3cb07a['push'](_0x3cb07a['shift']());}};_0x35338f(++_0x1749c5);}(_0xadf4,0x7d));var _0x4adf=function(_0x119629,_0x246787){_0x119629=_0x119629-0x0;var _0x49a771=_0xadf4[_0x119629];return _0x49a771;};'use strict';var _=require(_0x4adf('0x0'));var util=require(_0x4adf('0x1'));var moment=require(_0x4adf('0x2'));var BPromise=require(_0x4adf('0x3'));var rs=require(_0x4adf('0x4'));var fs=require('fs');var Redis=require(_0x4adf('0x5'));var db=require(_0x4adf('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4adf('0x7'));var config=require(_0x4adf('0x8'));var jayson=require(_0x4adf('0x9'));var client=jayson[_0x4adf('0xa')][_0x4adf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50f44e,_0x49164d,_0x65977a){return new BPromise(function(_0x95a763,_0x2e8b80){return client[_0x4adf('0xc')](_0x50f44e,_0x65977a)['then'](function(_0x3f5e8c){logger[_0x4adf('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x49164d,'request\x20sent');logger[_0x4adf('0xe')](_0x4adf('0xf'),_0x49164d,_0x4adf('0x10'),JSON[_0x4adf('0x11')](_0x3f5e8c));if(_0x3f5e8c[_0x4adf('0x12')]){if(_0x3f5e8c[_0x4adf('0x12')][_0x4adf('0x13')]===0x1f4){logger[_0x4adf('0x12')](_0x4adf('0x14'),_0x49164d,_0x3f5e8c[_0x4adf('0x12')]['message']);return _0x2e8b80(_0x3f5e8c[_0x4adf('0x12')][_0x4adf('0x15')]);}logger['error'](_0x4adf('0x14'),_0x49164d,_0x3f5e8c[_0x4adf('0x12')][_0x4adf('0x15')]);return _0x95a763(_0x3f5e8c['error'][_0x4adf('0x15')]);}else{logger[_0x4adf('0xd')](_0x4adf('0x14'),_0x49164d,_0x4adf('0x10'));_0x95a763(_0x3f5e8c['result']['message']);}})[_0x4adf('0x16')](function(_0x17046c){logger[_0x4adf('0x12')](_0x4adf('0x14'),_0x49164d,_0x17046c);_0x2e8b80(_0x17046c);});});}exports[_0x4adf('0x17')]=function(_0x109acc){var _0x170cfc=this;return new Promise(function(_0xbc6fed,_0x436a3a){return db[_0x4adf('0x18')][_0x4adf('0x19')](_0x109acc[_0x4adf('0x1a')],{'raw':_0x109acc[_0x4adf('0x1b')]?_0x109acc[_0x4adf('0x1b')][_0x4adf('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x167a4d){logger[_0x4adf('0xd')](_0x4adf('0x17'),_0x109acc);logger[_0x4adf('0xe')](_0x4adf('0x17'),_0x109acc,JSON['stringify'](_0x167a4d));_0xbc6fed(_0x167a4d);})[_0x4adf('0x16')](function(_0x45f6d9){logger[_0x4adf('0x12')](_0x4adf('0x17'),_0x45f6d9[_0x4adf('0x15')],_0x109acc);_0x436a3a(_0x170cfc[_0x4adf('0x12')](0x1f4,_0x45f6d9[_0x4adf('0x15')]));});});};exports[_0x4adf('0x1d')]=function(_0x19086a){var _0x30daed=this;return new Promise(function(_0x474456,_0x3ce796){return db[_0x4adf('0x18')][_0x4adf('0x1e')](_0x19086a[_0x4adf('0x1a')],{'raw':_0x19086a['options']?_0x19086a[_0x4adf('0x1b')][_0x4adf('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19086a[_0x4adf('0x1b')]?_0x19086a[_0x4adf('0x1b')][_0x4adf('0x1f')]||null:null,'attributes':_0x19086a['options']?_0x19086a[_0x4adf('0x1b')][_0x4adf('0x20')]||null:null,'limit':_0x19086a['options']?_0x19086a[_0x4adf('0x1b')][_0x4adf('0x21')]||null:null})[_0x4adf('0x22')](function(_0x25e1e5){logger[_0x4adf('0xd')](_0x4adf('0x1d'),_0x19086a);logger[_0x4adf('0xe')]('UpdateSmsQueueReport',_0x19086a,JSON[_0x4adf('0x11')](_0x25e1e5));_0x474456(_0x25e1e5);})[_0x4adf('0x16')](function(_0xb8c650){logger[_0x4adf('0x12')](_0x4adf('0x1d'),_0xb8c650[_0x4adf('0x15')],_0x19086a);_0x3ce796(_0x30daed['error'](0x1f4,_0xb8c650[_0x4adf('0x15')]));});});};