Built motion from commit (unavailable).|2.4.18
[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 _0xbfd5=['message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1f1cc7,_0x26f365){var _0x5f49e9=function(_0x45c75a){while(--_0x45c75a){_0x1f1cc7['push'](_0x1f1cc7['shift']());}};_0x5f49e9(++_0x26f365);}(_0xbfd5,0x155));var _0x5bfd=function(_0x329273,_0x62402f){_0x329273=_0x329273-0x0;var _0x338d5e=_0xbfd5[_0x329273];return _0x338d5e;};'use strict';var _=require(_0x5bfd('0x0'));var util=require(_0x5bfd('0x1'));var moment=require(_0x5bfd('0x2'));var BPromise=require(_0x5bfd('0x3'));var rs=require(_0x5bfd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bfd('0x5'))['db'];var utils=require(_0x5bfd('0x6'));var logger=require(_0x5bfd('0x7'))(_0x5bfd('0x8'));var config=require(_0x5bfd('0x9'));var jayson=require(_0x5bfd('0xa'));var client=jayson[_0x5bfd('0xb')][_0x5bfd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x540a69,_0x379316,_0x3fca93){return new BPromise(function(_0x21730e,_0x348b44){return client[_0x5bfd('0xd')](_0x540a69,_0x3fca93)[_0x5bfd('0xe')](function(_0x27853a){logger[_0x5bfd('0xf')](_0x5bfd('0x10'),_0x379316,'request\x20sent');logger[_0x5bfd('0x11')](_0x5bfd('0x12'),_0x379316,_0x5bfd('0x13'),JSON[_0x5bfd('0x14')](_0x27853a));if(_0x27853a[_0x5bfd('0x15')]){if(_0x27853a[_0x5bfd('0x15')]['code']===0x1f4){logger['error'](_0x5bfd('0x10'),_0x379316,_0x27853a[_0x5bfd('0x15')]['message']);return _0x348b44(_0x27853a['error'][_0x5bfd('0x16')]);}logger[_0x5bfd('0x15')](_0x5bfd('0x10'),_0x379316,_0x27853a['error'][_0x5bfd('0x16')]);return _0x21730e(_0x27853a[_0x5bfd('0x15')][_0x5bfd('0x16')]);}else{logger[_0x5bfd('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x379316,_0x5bfd('0x13'));_0x21730e(_0x27853a[_0x5bfd('0x17')][_0x5bfd('0x16')]);}})[_0x5bfd('0x18')](function(_0x1b8c5f){logger[_0x5bfd('0x15')](_0x5bfd('0x10'),_0x379316,_0x1b8c5f);_0x348b44(_0x1b8c5f);});});}exports[_0x5bfd('0x19')]=function(_0x410527){var _0x52468c=this;return new Promise(function(_0x3311b9,_0x5b317c){return db[_0x5bfd('0x1a')][_0x5bfd('0x1b')](_0x410527[_0x5bfd('0x1c')],{'raw':_0x410527[_0x5bfd('0x1d')]?_0x410527['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x47e4cb){logger[_0x5bfd('0xf')](_0x5bfd('0x19'),_0x410527);logger[_0x5bfd('0x11')](_0x5bfd('0x19'),_0x410527,JSON[_0x5bfd('0x14')](_0x47e4cb));_0x3311b9(_0x47e4cb);})[_0x5bfd('0x18')](function(_0x41cc13){logger[_0x5bfd('0x15')]('CreateSmsQueueReport',_0x41cc13[_0x5bfd('0x16')],_0x410527);_0x5b317c(_0x52468c[_0x5bfd('0x15')](0x1f4,_0x41cc13[_0x5bfd('0x16')]));});});};exports['UpdateSmsQueueReport']=function(_0x120841){var _0x3a0ade=this;return new Promise(function(_0x21ff00,_0x3e1575){return db['SmsQueueReport']['update'](_0x120841[_0x5bfd('0x1c')],{'raw':_0x120841['options']?_0x120841[_0x5bfd('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x120841[_0x5bfd('0x1d')]?_0x120841[_0x5bfd('0x1d')]['where']||null:null,'attributes':_0x120841[_0x5bfd('0x1d')]?_0x120841[_0x5bfd('0x1d')][_0x5bfd('0x1e')]||null:null,'limit':_0x120841['options']?_0x120841[_0x5bfd('0x1d')][_0x5bfd('0x1f')]||null:null})['then'](function(_0x1ae832){logger[_0x5bfd('0xf')](_0x5bfd('0x20'),_0x120841);logger[_0x5bfd('0x11')](_0x5bfd('0x20'),_0x120841,JSON['stringify'](_0x1ae832));_0x21ff00(_0x1ae832);})[_0x5bfd('0x18')](function(_0x5b9a53){logger[_0x5bfd('0x15')](_0x5bfd('0x20'),_0x5b9a53[_0x5bfd('0x16')],_0x120841);_0x3e1575(_0x3a0ade[_0x5bfd('0x15')](0x1f4,_0x5b9a53[_0x5bfd('0x16')]));});});};