Built motion from commit e6806ed6.|2.6.0
[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 _0xfc9b=['update','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateMemberReport','body'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfc9b,0x74));var _0xbfc9=function(_0x59cf85,_0x35005e){_0x59cf85=_0x59cf85-0x0;var _0x36fb0d=_0xfc9b[_0x59cf85];return _0x36fb0d;};'use strict';var _=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var moment=require(_0xbfc9('0x2'));var BPromise=require(_0xbfc9('0x3'));var rs=require(_0xbfc9('0x4'));var fs=require('fs');var Redis=require(_0xbfc9('0x5'));var db=require(_0xbfc9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfc9('0x7'))('rpc');var config=require(_0xbfc9('0x8'));var jayson=require(_0xbfc9('0x9'));var client=jayson['client'][_0xbfc9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x266c05,_0xed6492,_0xe288d1){return new BPromise(function(_0x4e0f74,_0x12bf13){return client['request'](_0x266c05,_0xe288d1)[_0xbfc9('0xb')](function(_0x5073cf){logger[_0xbfc9('0xc')]('MemberReport,\x20%s,\x20%s',_0xed6492,_0xbfc9('0xd'));logger[_0xbfc9('0xe')](_0xbfc9('0xf'),_0xed6492,_0xbfc9('0xd'),JSON[_0xbfc9('0x10')](_0x5073cf));if(_0x5073cf[_0xbfc9('0x11')]){if(_0x5073cf['error'][_0xbfc9('0x12')]===0x1f4){logger[_0xbfc9('0x11')]('MemberReport,\x20%s,\x20%s',_0xed6492,_0x5073cf[_0xbfc9('0x11')]['message']);return _0x12bf13(_0x5073cf[_0xbfc9('0x11')][_0xbfc9('0x13')]);}logger[_0xbfc9('0x11')](_0xbfc9('0x14'),_0xed6492,_0x5073cf['error'][_0xbfc9('0x13')]);return _0x4e0f74(_0x5073cf[_0xbfc9('0x11')][_0xbfc9('0x13')]);}else{logger[_0xbfc9('0xc')](_0xbfc9('0x14'),_0xed6492,_0xbfc9('0xd'));_0x4e0f74(_0x5073cf[_0xbfc9('0x15')][_0xbfc9('0x13')]);}})[_0xbfc9('0x16')](function(_0x42cacd){logger[_0xbfc9('0x11')](_0xbfc9('0x14'),_0xed6492,_0x42cacd);_0x12bf13(_0x42cacd);});});}exports[_0xbfc9('0x17')]=function(_0x21e216){var _0x12755a=this;return new Promise(function(_0x345e7a,_0xa78e78){return db[_0xbfc9('0x18')][_0xbfc9('0x19')]({'raw':_0x21e216[_0xbfc9('0x1a')]?_0x21e216[_0xbfc9('0x1a')][_0xbfc9('0x1b')]===undefined?!![]:![]:!![],'where':_0x21e216['options']?_0x21e216[_0xbfc9('0x1a')][_0xbfc9('0x1c')]||null:null,'attributes':_0x21e216[_0xbfc9('0x1a')]?_0x21e216[_0xbfc9('0x1a')][_0xbfc9('0x1d')]||null:null,'limit':_0x21e216[_0xbfc9('0x1a')]?_0x21e216[_0xbfc9('0x1a')][_0xbfc9('0x1e')]||null:null,'include':_0x21e216[_0xbfc9('0x1a')]?_0x21e216[_0xbfc9('0x1a')][_0xbfc9('0x1f')]?_[_0xbfc9('0x20')](_0x21e216[_0xbfc9('0x1a')][_0xbfc9('0x1f')],function(_0x5a3420){return{'model':db[_0x5a3420[_0xbfc9('0x21')]],'as':_0x5a3420['as'],'attributes':_0x5a3420[_0xbfc9('0x1d')],'include':_0x5a3420[_0xbfc9('0x1f')]?_[_0xbfc9('0x20')](_0x5a3420[_0xbfc9('0x1f')],function(_0x4ab0ec){return{'model':db[_0x4ab0ec[_0xbfc9('0x21')]],'as':_0x4ab0ec['as'],'attributes':_0x4ab0ec[_0xbfc9('0x1d')],'include':_0x4ab0ec[_0xbfc9('0x1f')]?_[_0xbfc9('0x20')](_0x4ab0ec[_0xbfc9('0x1f')],function(_0xfa504){return{'model':db[_0xfa504[_0xbfc9('0x21')]],'as':_0xfa504['as'],'attributes':_0xfa504[_0xbfc9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbfc9('0xb')](function(_0x4f5e21){logger['info']('GetMemberReport',_0x21e216);logger[_0xbfc9('0xe')]('GetMemberReport',_0x21e216,JSON['stringify'](_0x4f5e21));_0x345e7a(_0x4f5e21);})[_0xbfc9('0x16')](function(_0x2aa754){logger[_0xbfc9('0x11')](_0xbfc9('0x17'),_0x2aa754[_0xbfc9('0x13')],_0x21e216);_0xa78e78(_0x12755a[_0xbfc9('0x11')](0x1f4,_0x2aa754[_0xbfc9('0x13')]));});});};exports[_0xbfc9('0x22')]=function(_0x283d2d){var _0x56c98e=this;return new Promise(function(_0x310f94,_0xd845d7){return db[_0xbfc9('0x18')]['create'](_0x283d2d[_0xbfc9('0x23')],{'raw':_0x283d2d[_0xbfc9('0x1a')]?_0x283d2d[_0xbfc9('0x1a')][_0xbfc9('0x1b')]===undefined?!![]:![]:!![]})[_0xbfc9('0xb')](function(_0x4155db){logger[_0xbfc9('0xc')](_0xbfc9('0x22'),_0x283d2d);logger[_0xbfc9('0xe')](_0xbfc9('0x22'),_0x283d2d,JSON['stringify'](_0x4155db));_0x310f94(_0x4155db);})['catch'](function(_0x143f91){logger[_0xbfc9('0x11')](_0xbfc9('0x22'),_0x143f91[_0xbfc9('0x13')],_0x283d2d);_0xd845d7(_0x56c98e[_0xbfc9('0x11')](0x1f4,_0x143f91[_0xbfc9('0x13')]));});});};exports['UpdateMemberReport']=function(_0x1bd473){var _0x4b438d=this;return new Promise(function(_0x5509b6,_0x2bec44){return db['MemberReport'][_0xbfc9('0x24')](_0x1bd473[_0xbfc9('0x23')],{'raw':_0x1bd473[_0xbfc9('0x1a')]?_0x1bd473['options'][_0xbfc9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bd473['options']?_0x1bd473['options'][_0xbfc9('0x1c')]||null:null,'attributes':_0x1bd473[_0xbfc9('0x1a')]?_0x1bd473['options'][_0xbfc9('0x1d')]||null:null,'limit':_0x1bd473['options']?_0x1bd473['options'][_0xbfc9('0x1e')]||null:null})[_0xbfc9('0xb')](function(_0x3260e6){logger[_0xbfc9('0xc')](_0xbfc9('0x25'),_0x1bd473);logger[_0xbfc9('0xe')](_0xbfc9('0x25'),_0x1bd473,JSON[_0xbfc9('0x10')](_0x3260e6));_0x5509b6(_0x3260e6);})['catch'](function(_0x23d4b1){logger[_0xbfc9('0x11')]('UpdateMemberReport',_0x23d4b1['message'],_0x1bd473);_0x2bec44(_0x4b438d[_0xbfc9('0x11')](0x1f4,_0x23d4b1[_0xbfc9('0x13')]));});});};