Built motion from commit (unavailable).|2.5.8
[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 _0x419f=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','where','limit','lodash'];(function(_0x5c12f2,_0x5de043){var _0x5e8344=function(_0x445932){while(--_0x445932){_0x5c12f2['push'](_0x5c12f2['shift']());}};_0x5e8344(++_0x5de043);}(_0x419f,0x154));var _0xf419=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x419f[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xf419('0x0'));var util=require(_0xf419('0x1'));var moment=require(_0xf419('0x2'));var BPromise=require(_0xf419('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf419('0x4'));var db=require(_0xf419('0x5'))['db'];var utils=require(_0xf419('0x6'));var logger=require(_0xf419('0x7'))(_0xf419('0x8'));var config=require(_0xf419('0x9'));var jayson=require(_0xf419('0xa'));var client=jayson['client'][_0xf419('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13694b,_0xd70160,_0x40bdcb){return new BPromise(function(_0x290c4b,_0xd12ea6){return client['request'](_0x13694b,_0x40bdcb)[_0xf419('0xc')](function(_0x52f28e){logger[_0xf419('0xd')](_0xf419('0xe'),_0xd70160,'request\x20sent');logger[_0xf419('0xf')](_0xf419('0x10'),_0xd70160,_0xf419('0x11'),JSON[_0xf419('0x12')](_0x52f28e));if(_0x52f28e['error']){if(_0x52f28e[_0xf419('0x13')]['code']===0x1f4){logger[_0xf419('0x13')](_0xf419('0xe'),_0xd70160,_0x52f28e[_0xf419('0x13')][_0xf419('0x14')]);return _0xd12ea6(_0x52f28e['error'][_0xf419('0x14')]);}logger[_0xf419('0x13')](_0xf419('0xe'),_0xd70160,_0x52f28e[_0xf419('0x13')][_0xf419('0x14')]);return _0x290c4b(_0x52f28e[_0xf419('0x13')]['message']);}else{logger[_0xf419('0xd')](_0xf419('0xe'),_0xd70160,'request\x20sent');_0x290c4b(_0x52f28e[_0xf419('0x15')][_0xf419('0x14')]);}})[_0xf419('0x16')](function(_0xd6ac2a){logger[_0xf419('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0xd70160,_0xd6ac2a);_0xd12ea6(_0xd6ac2a);});});}exports[_0xf419('0x17')]=function(_0xc46d91){var _0x54999b=this;return new Promise(function(_0x1d9c5a,_0x1c1284){return db[_0xf419('0x18')][_0xf419('0x19')](_0xc46d91[_0xf419('0x1a')],{'raw':_0xc46d91[_0xf419('0x1b')]?_0xc46d91[_0xf419('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xf419('0xc')](function(_0x2c80bd){logger[_0xf419('0xd')](_0xf419('0x17'),_0xc46d91);logger[_0xf419('0xf')](_0xf419('0x17'),_0xc46d91,JSON[_0xf419('0x12')](_0x2c80bd));_0x1d9c5a(_0x2c80bd);})['catch'](function(_0xd7a02){logger[_0xf419('0x13')](_0xf419('0x17'),_0xd7a02[_0xf419('0x14')],_0xc46d91);_0x1c1284(_0x54999b[_0xf419('0x13')](0x1f4,_0xd7a02[_0xf419('0x14')]));});});};exports[_0xf419('0x1c')]=function(_0x156265){var _0x398ec2=this;return new Promise(function(_0x457206,_0x17fd14){return db[_0xf419('0x18')]['update'](_0x156265['body'],{'raw':_0x156265[_0xf419('0x1b')]?_0x156265[_0xf419('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x156265[_0xf419('0x1b')]?_0x156265[_0xf419('0x1b')][_0xf419('0x1d')]||null:null,'attributes':_0x156265['options']?_0x156265[_0xf419('0x1b')]['attributes']||null:null,'limit':_0x156265[_0xf419('0x1b')]?_0x156265['options'][_0xf419('0x1e')]||null:null})[_0xf419('0xc')](function(_0x306857){logger['info'](_0xf419('0x1c'),_0x156265);logger[_0xf419('0xf')](_0xf419('0x1c'),_0x156265,JSON[_0xf419('0x12')](_0x306857));_0x457206(_0x306857);})[_0xf419('0x16')](function(_0x4edb39){logger['error']('UpdateSmsQueueReport',_0x4edb39[_0xf419('0x14')],_0x156265);_0x17fd14(_0x398ec2['error'](0x1f4,_0x4edb39[_0xf419('0x14')]));});});};