Built motion from commit (unavailable).|2.5.3
[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 _0xfc50=['where','attributes','include','map','model','stringify','CreateMemberReport','create','UpdateMemberReport','update','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw'];(function(_0x375ccf,_0x14964c){var _0x1507e8=function(_0x482e1e){while(--_0x482e1e){_0x375ccf['push'](_0x375ccf['shift']());}};_0x1507e8(++_0x14964c);}(_0xfc50,0x13c));var _0x0fc5=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xfc50[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0fc5('0x0'));var util=require(_0x0fc5('0x1'));var moment=require(_0x0fc5('0x2'));var BPromise=require(_0x0fc5('0x3'));var rs=require(_0x0fc5('0x4'));var fs=require('fs');var Redis=require(_0x0fc5('0x5'));var db=require(_0x0fc5('0x6'))['db'];var utils=require(_0x0fc5('0x7'));var logger=require(_0x0fc5('0x8'))('rpc');var config=require(_0x0fc5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0fc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x474bb9,_0x5335d5,_0x35fa72){return new BPromise(function(_0x2e28b2,_0x445a94){return client[_0x0fc5('0xb')](_0x474bb9,_0x35fa72)[_0x0fc5('0xc')](function(_0x24d9a7){logger[_0x0fc5('0xd')](_0x0fc5('0xe'),_0x5335d5,'request\x20sent');logger[_0x0fc5('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x5335d5,_0x0fc5('0x10'),JSON['stringify'](_0x24d9a7));if(_0x24d9a7['error']){if(_0x24d9a7[_0x0fc5('0x11')]['code']===0x1f4){logger[_0x0fc5('0x11')](_0x0fc5('0xe'),_0x5335d5,_0x24d9a7['error'][_0x0fc5('0x12')]);return _0x445a94(_0x24d9a7[_0x0fc5('0x11')][_0x0fc5('0x12')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x5335d5,_0x24d9a7[_0x0fc5('0x11')][_0x0fc5('0x12')]);return _0x2e28b2(_0x24d9a7[_0x0fc5('0x11')]['message']);}else{logger[_0x0fc5('0xd')](_0x0fc5('0xe'),_0x5335d5,_0x0fc5('0x10'));_0x2e28b2(_0x24d9a7[_0x0fc5('0x13')][_0x0fc5('0x12')]);}})[_0x0fc5('0x14')](function(_0x284895){logger[_0x0fc5('0x11')](_0x0fc5('0xe'),_0x5335d5,_0x284895);_0x445a94(_0x284895);});});}exports[_0x0fc5('0x15')]=function(_0x29839f){var _0xe9f48=this;return new Promise(function(_0x5a3d95,_0x577e9f){return db[_0x0fc5('0x16')][_0x0fc5('0x17')]({'raw':_0x29839f[_0x0fc5('0x18')]?_0x29839f[_0x0fc5('0x18')][_0x0fc5('0x19')]===undefined?!![]:![]:!![],'where':_0x29839f['options']?_0x29839f[_0x0fc5('0x18')][_0x0fc5('0x1a')]||null:null,'attributes':_0x29839f[_0x0fc5('0x18')]?_0x29839f[_0x0fc5('0x18')][_0x0fc5('0x1b')]||null:null,'limit':_0x29839f[_0x0fc5('0x18')]?_0x29839f[_0x0fc5('0x18')]['limit']||null:null,'include':_0x29839f['options']?_0x29839f[_0x0fc5('0x18')][_0x0fc5('0x1c')]?_[_0x0fc5('0x1d')](_0x29839f[_0x0fc5('0x18')]['include'],function(_0x2652c6){return{'model':db[_0x2652c6[_0x0fc5('0x1e')]],'as':_0x2652c6['as'],'attributes':_0x2652c6['attributes'],'include':_0x2652c6[_0x0fc5('0x1c')]?_['map'](_0x2652c6['include'],function(_0x4a9900){return{'model':db[_0x4a9900['model']],'as':_0x4a9900['as'],'attributes':_0x4a9900[_0x0fc5('0x1b')],'include':_0x4a9900[_0x0fc5('0x1c')]?_[_0x0fc5('0x1d')](_0x4a9900[_0x0fc5('0x1c')],function(_0x33995c){return{'model':db[_0x33995c['model']],'as':_0x33995c['as'],'attributes':_0x33995c[_0x0fc5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3950d1){logger[_0x0fc5('0xd')](_0x0fc5('0x15'),_0x29839f);logger[_0x0fc5('0xf')](_0x0fc5('0x15'),_0x29839f,JSON[_0x0fc5('0x1f')](_0x3950d1));_0x5a3d95(_0x3950d1);})[_0x0fc5('0x14')](function(_0x50106b){logger[_0x0fc5('0x11')](_0x0fc5('0x15'),_0x50106b[_0x0fc5('0x12')],_0x29839f);_0x577e9f(_0xe9f48[_0x0fc5('0x11')](0x1f4,_0x50106b[_0x0fc5('0x12')]));});});};exports[_0x0fc5('0x20')]=function(_0x3a6a99){var _0x1de323=this;return new Promise(function(_0x55228a,_0x1481b7){return db[_0x0fc5('0x16')][_0x0fc5('0x21')](_0x3a6a99['body'],{'raw':_0x3a6a99[_0x0fc5('0x18')]?_0x3a6a99[_0x0fc5('0x18')][_0x0fc5('0x19')]===undefined?!![]:![]:!![]})[_0x0fc5('0xc')](function(_0x14a00d){logger[_0x0fc5('0xd')]('CreateMemberReport',_0x3a6a99);logger[_0x0fc5('0xf')](_0x0fc5('0x20'),_0x3a6a99,JSON['stringify'](_0x14a00d));_0x55228a(_0x14a00d);})['catch'](function(_0x24912e){logger[_0x0fc5('0x11')](_0x0fc5('0x20'),_0x24912e[_0x0fc5('0x12')],_0x3a6a99);_0x1481b7(_0x1de323[_0x0fc5('0x11')](0x1f4,_0x24912e[_0x0fc5('0x12')]));});});};exports[_0x0fc5('0x22')]=function(_0x2b07ce){var _0x24f0fe=this;return new Promise(function(_0x4cbd7a,_0x380a22){return db[_0x0fc5('0x16')][_0x0fc5('0x23')](_0x2b07ce[_0x0fc5('0x24')],{'raw':_0x2b07ce[_0x0fc5('0x18')]?_0x2b07ce['options'][_0x0fc5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b07ce[_0x0fc5('0x18')]?_0x2b07ce['options'][_0x0fc5('0x1a')]||null:null,'attributes':_0x2b07ce[_0x0fc5('0x18')]?_0x2b07ce[_0x0fc5('0x18')][_0x0fc5('0x1b')]||null:null,'limit':_0x2b07ce[_0x0fc5('0x18')]?_0x2b07ce['options'][_0x0fc5('0x25')]||null:null})[_0x0fc5('0xc')](function(_0x2675a7){logger[_0x0fc5('0xd')](_0x0fc5('0x22'),_0x2b07ce);logger['debug'](_0x0fc5('0x22'),_0x2b07ce,JSON[_0x0fc5('0x1f')](_0x2675a7));_0x4cbd7a(_0x2675a7);})[_0x0fc5('0x14')](function(_0x1f935b){logger[_0x0fc5('0x11')](_0x0fc5('0x22'),_0x1f935b[_0x0fc5('0x12')],_0x2b07ce);_0x380a22(_0x24f0fe[_0x0fc5('0x11')](0x1f4,_0x1f935b[_0x0fc5('0x12')]));});});};