Built motion from commit (unavailable).|2.3.9
[motion2.git] / server / api / memberReport / memberReport.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 _0x714f=['moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','body','CreateMemberReport','UpdateMemberReport','update','lodash'];(function(_0x45d5ef,_0x37cd2f){var _0x5c291b=function(_0x18dcb3){while(--_0x18dcb3){_0x45d5ef['push'](_0x45d5ef['shift']());}};_0x5c291b(++_0x37cd2f);}(_0x714f,0x197));var _0xf714=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0x714f[_0x36fbef];return _0x45e270;};'use strict';var _=require(_0xf714('0x0'));var util=require('util');var moment=require(_0xf714('0x1'));var BPromise=require('bluebird');var rs=require(_0xf714('0x2'));var fs=require('fs');var Redis=require(_0xf714('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf714('0x4'))('rpc');var config=require(_0xf714('0x5'));var jayson=require(_0xf714('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b6bac,_0x55fb8e,_0x176bb0){return new BPromise(function(_0x4bab82,_0x5c10ac){return client[_0xf714('0x7')](_0x3b6bac,_0x176bb0)[_0xf714('0x8')](function(_0xc02df2){logger[_0xf714('0x9')](_0xf714('0xa'),_0x55fb8e,_0xf714('0xb'));logger[_0xf714('0xc')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x55fb8e,_0xf714('0xb'),JSON[_0xf714('0xd')](_0xc02df2));if(_0xc02df2[_0xf714('0xe')]){if(_0xc02df2['error'][_0xf714('0xf')]===0x1f4){logger[_0xf714('0xe')]('MemberReport,\x20%s,\x20%s',_0x55fb8e,_0xc02df2[_0xf714('0xe')][_0xf714('0x10')]);return _0x5c10ac(_0xc02df2[_0xf714('0xe')][_0xf714('0x10')]);}logger[_0xf714('0xe')](_0xf714('0xa'),_0x55fb8e,_0xc02df2[_0xf714('0xe')]['message']);return _0x4bab82(_0xc02df2[_0xf714('0xe')][_0xf714('0x10')]);}else{logger[_0xf714('0x9')](_0xf714('0xa'),_0x55fb8e,_0xf714('0xb'));_0x4bab82(_0xc02df2[_0xf714('0x11')][_0xf714('0x10')]);}})[_0xf714('0x12')](function(_0x385ca0){logger[_0xf714('0xe')](_0xf714('0xa'),_0x55fb8e,_0x385ca0);_0x5c10ac(_0x385ca0);});});}exports[_0xf714('0x13')]=function(_0x6137e5){var _0x25bcf3=this;return new Promise(function(_0x2e7c31,_0x5eeb9d){return db[_0xf714('0x14')][_0xf714('0x15')]({'raw':_0x6137e5[_0xf714('0x16')]?_0x6137e5[_0xf714('0x16')][_0xf714('0x17')]===undefined?!![]:![]:!![],'where':_0x6137e5[_0xf714('0x16')]?_0x6137e5[_0xf714('0x16')][_0xf714('0x18')]||null:null,'attributes':_0x6137e5[_0xf714('0x16')]?_0x6137e5[_0xf714('0x16')][_0xf714('0x19')]||null:null,'limit':_0x6137e5[_0xf714('0x16')]?_0x6137e5[_0xf714('0x16')][_0xf714('0x1a')]||null:null,'include':_0x6137e5[_0xf714('0x16')]?_0x6137e5[_0xf714('0x16')][_0xf714('0x1b')]?_[_0xf714('0x1c')](_0x6137e5[_0xf714('0x16')][_0xf714('0x1b')],function(_0x33ba3d){return{'model':db[_0x33ba3d[_0xf714('0x1d')]],'as':_0x33ba3d['as'],'attributes':_0x33ba3d[_0xf714('0x19')],'include':_0x33ba3d[_0xf714('0x1b')]?_['map'](_0x33ba3d['include'],function(_0x17c710){return{'model':db[_0x17c710[_0xf714('0x1d')]],'as':_0x17c710['as'],'attributes':_0x17c710[_0xf714('0x19')],'include':_0x17c710[_0xf714('0x1b')]?_[_0xf714('0x1c')](_0x17c710[_0xf714('0x1b')],function(_0x554c19){return{'model':db[_0x554c19[_0xf714('0x1d')]],'as':_0x554c19['as'],'attributes':_0x554c19['attributes']};}):[]};}):[]};}):[]:[]})[_0xf714('0x8')](function(_0x23cfeb){logger['info']('GetMemberReport',_0x6137e5);logger[_0xf714('0xc')]('GetMemberReport',_0x6137e5,JSON['stringify'](_0x23cfeb));_0x2e7c31(_0x23cfeb);})[_0xf714('0x12')](function(_0x42d0cb){logger[_0xf714('0xe')](_0xf714('0x13'),_0x42d0cb[_0xf714('0x10')],_0x6137e5);_0x5eeb9d(_0x25bcf3[_0xf714('0xe')](0x1f4,_0x42d0cb[_0xf714('0x10')]));});});};exports['CreateMemberReport']=function(_0x434c27){var _0x4bfd8f=this;return new Promise(function(_0x36908f,_0x3bd4b2){return db[_0xf714('0x14')]['create'](_0x434c27[_0xf714('0x1e')],{'raw':_0x434c27[_0xf714('0x16')]?_0x434c27[_0xf714('0x16')][_0xf714('0x17')]===undefined?!![]:![]:!![]})[_0xf714('0x8')](function(_0x1e2796){logger[_0xf714('0x9')](_0xf714('0x1f'),_0x434c27);logger[_0xf714('0xc')]('CreateMemberReport',_0x434c27,JSON[_0xf714('0xd')](_0x1e2796));_0x36908f(_0x1e2796);})[_0xf714('0x12')](function(_0xe733a){logger[_0xf714('0xe')](_0xf714('0x1f'),_0xe733a['message'],_0x434c27);_0x3bd4b2(_0x4bfd8f[_0xf714('0xe')](0x1f4,_0xe733a[_0xf714('0x10')]));});});};exports[_0xf714('0x20')]=function(_0x39ad98){var _0x3f9b37=this;return new Promise(function(_0xf7922c,_0x93b567){return db[_0xf714('0x14')][_0xf714('0x21')](_0x39ad98[_0xf714('0x1e')],{'raw':_0x39ad98[_0xf714('0x16')]?_0x39ad98[_0xf714('0x16')][_0xf714('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39ad98[_0xf714('0x16')]?_0x39ad98[_0xf714('0x16')][_0xf714('0x18')]||null:null,'attributes':_0x39ad98[_0xf714('0x16')]?_0x39ad98[_0xf714('0x16')][_0xf714('0x19')]||null:null,'limit':_0x39ad98['options']?_0x39ad98[_0xf714('0x16')][_0xf714('0x1a')]||null:null})['then'](function(_0xa148c0){logger['info'](_0xf714('0x20'),_0x39ad98);logger[_0xf714('0xc')](_0xf714('0x20'),_0x39ad98,JSON[_0xf714('0xd')](_0xa148c0));_0xf7922c(_0xa148c0);})[_0xf714('0x12')](function(_0x43a13f){logger[_0xf714('0xe')](_0xf714('0x20'),_0x43a13f[_0xf714('0x10')],_0x39ad98);_0x93b567(_0x3f9b37['error'](0x1f4,_0x43a13f[_0xf714('0x10')]));});});};