Built motion from commit (unavailable).|2.5.11
[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 _0x80ab=['../../config/utils','rpc','jayson/promise','client','request','then','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','SmsQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','stringify','UpdateSmsQueueReport','update','where','attributes','lodash','moment','randomstring','../../mysqldb'];(function(_0x2a2a77,_0x34e415){var _0x3c8e22=function(_0x26d669){while(--_0x26d669){_0x2a2a77['push'](_0x2a2a77['shift']());}};_0x3c8e22(++_0x34e415);}(_0x80ab,0x97));var _0xb80a=function(_0x24a440,_0x9015c8){_0x24a440=_0x24a440-0x0;var _0xf9d75a=_0x80ab[_0x24a440];return _0xf9d75a;};'use strict';var _=require(_0xb80a('0x0'));var util=require('util');var moment=require(_0xb80a('0x1'));var BPromise=require('bluebird');var rs=require(_0xb80a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb80a('0x3'))['db'];var utils=require(_0xb80a('0x4'));var logger=require('../../config/logger')(_0xb80a('0x5'));var config=require('../../config/environment');var jayson=require(_0xb80a('0x6'));var client=jayson[_0xb80a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2518f2,_0x1fcd45,_0x1b0b80){return new BPromise(function(_0x43a88c,_0x4380e8){return client[_0xb80a('0x8')](_0x2518f2,_0x1b0b80)[_0xb80a('0x9')](function(_0x578247){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x1fcd45,_0xb80a('0xa'));logger['debug'](_0xb80a('0xb'),_0x1fcd45,_0xb80a('0xa'),JSON['stringify'](_0x578247));if(_0x578247[_0xb80a('0xc')]){if(_0x578247[_0xb80a('0xc')][_0xb80a('0xd')]===0x1f4){logger[_0xb80a('0xc')](_0xb80a('0xe'),_0x1fcd45,_0x578247[_0xb80a('0xc')][_0xb80a('0xf')]);return _0x4380e8(_0x578247[_0xb80a('0xc')]['message']);}logger[_0xb80a('0xc')](_0xb80a('0xe'),_0x1fcd45,_0x578247['error'][_0xb80a('0xf')]);return _0x43a88c(_0x578247[_0xb80a('0xc')]['message']);}else{logger[_0xb80a('0x10')](_0xb80a('0xe'),_0x1fcd45,'request\x20sent');_0x43a88c(_0x578247[_0xb80a('0x11')][_0xb80a('0xf')]);}})[_0xb80a('0x12')](function(_0x20ff0e){logger[_0xb80a('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x1fcd45,_0x20ff0e);_0x4380e8(_0x20ff0e);});});}exports[_0xb80a('0x13')]=function(_0x516466){var _0x85500b=this;return new Promise(function(_0x33a45f,_0x165f72){return db[_0xb80a('0x14')][_0xb80a('0x15')](_0x516466[_0xb80a('0x16')],{'raw':_0x516466[_0xb80a('0x17')]?_0x516466['options'][_0xb80a('0x18')]===undefined?!![]:![]:!![]})[_0xb80a('0x9')](function(_0x7e2746){logger[_0xb80a('0x10')](_0xb80a('0x13'),_0x516466);logger[_0xb80a('0x19')](_0xb80a('0x13'),_0x516466,JSON[_0xb80a('0x1a')](_0x7e2746));_0x33a45f(_0x7e2746);})[_0xb80a('0x12')](function(_0x588f53){logger[_0xb80a('0xc')]('CreateSmsQueueReport',_0x588f53[_0xb80a('0xf')],_0x516466);_0x165f72(_0x85500b[_0xb80a('0xc')](0x1f4,_0x588f53['message']));});});};exports[_0xb80a('0x1b')]=function(_0x5e99a8){var _0xc218af=this;return new Promise(function(_0x3edddc,_0x123f8c){return db[_0xb80a('0x14')][_0xb80a('0x1c')](_0x5e99a8[_0xb80a('0x16')],{'raw':_0x5e99a8[_0xb80a('0x17')]?_0x5e99a8[_0xb80a('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e99a8[_0xb80a('0x17')]?_0x5e99a8['options'][_0xb80a('0x1d')]||null:null,'attributes':_0x5e99a8['options']?_0x5e99a8[_0xb80a('0x17')][_0xb80a('0x1e')]||null:null,'limit':_0x5e99a8['options']?_0x5e99a8[_0xb80a('0x17')]['limit']||null:null})[_0xb80a('0x9')](function(_0x53614a){logger[_0xb80a('0x10')]('UpdateSmsQueueReport',_0x5e99a8);logger[_0xb80a('0x19')](_0xb80a('0x1b'),_0x5e99a8,JSON[_0xb80a('0x1a')](_0x53614a));_0x3edddc(_0x53614a);})[_0xb80a('0x12')](function(_0x2fd701){logger[_0xb80a('0xc')]('UpdateSmsQueueReport',_0x2fd701[_0xb80a('0xf')],_0x5e99a8);_0x123f8c(_0xc218af[_0xb80a('0xc')](0x1f4,_0x2fd701[_0xb80a('0xf')]));});});};