Built motion from commit (unavailable).|2.4.18
[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 _0x61bc=['request\x20sent','debug','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','options','where','attributes','limit','include','map','model','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MemberReport,\x20%s,\x20%s'];(function(_0x1f47eb,_0x293500){var _0x4c677f=function(_0x32ce58){while(--_0x32ce58){_0x1f47eb['push'](_0x1f47eb['shift']());}};_0x4c677f(++_0x293500);}(_0x61bc,0x13f));var _0xc61b=function(_0x50f93d,_0x5923d9){_0x50f93d=_0x50f93d-0x0;var _0x57d80d=_0x61bc[_0x50f93d];return _0x57d80d;};'use strict';var _=require(_0xc61b('0x0'));var util=require(_0xc61b('0x1'));var moment=require(_0xc61b('0x2'));var BPromise=require('bluebird');var rs=require(_0xc61b('0x3'));var fs=require('fs');var Redis=require(_0xc61b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc61b('0x5'));var logger=require(_0xc61b('0x6'))(_0xc61b('0x7'));var config=require(_0xc61b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc61b('0x9')][_0xc61b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522604,_0x350ca7,_0x4f3380){return new BPromise(function(_0x11723c,_0x43627d){return client['request'](_0x522604,_0x4f3380)[_0xc61b('0xb')](function(_0x36fb82){logger[_0xc61b('0xc')](_0xc61b('0xd'),_0x350ca7,_0xc61b('0xe'));logger[_0xc61b('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x350ca7,_0xc61b('0xe'),JSON[_0xc61b('0x10')](_0x36fb82));if(_0x36fb82[_0xc61b('0x11')]){if(_0x36fb82['error'][_0xc61b('0x12')]===0x1f4){logger[_0xc61b('0x11')](_0xc61b('0xd'),_0x350ca7,_0x36fb82[_0xc61b('0x11')][_0xc61b('0x13')]);return _0x43627d(_0x36fb82[_0xc61b('0x11')][_0xc61b('0x13')]);}logger[_0xc61b('0x11')]('MemberReport,\x20%s,\x20%s',_0x350ca7,_0x36fb82[_0xc61b('0x11')][_0xc61b('0x13')]);return _0x11723c(_0x36fb82[_0xc61b('0x11')]['message']);}else{logger[_0xc61b('0xc')](_0xc61b('0xd'),_0x350ca7,_0xc61b('0xe'));_0x11723c(_0x36fb82[_0xc61b('0x14')]['message']);}})[_0xc61b('0x15')](function(_0x38be37){logger['error'](_0xc61b('0xd'),_0x350ca7,_0x38be37);_0x43627d(_0x38be37);});});}exports[_0xc61b('0x16')]=function(_0x16813e){var _0x479c6b=this;return new Promise(function(_0x335320,_0x497bbe){return db[_0xc61b('0x17')]['findAll']({'raw':_0x16813e[_0xc61b('0x18')]?_0x16813e['options']['raw']===undefined?!![]:![]:!![],'where':_0x16813e[_0xc61b('0x18')]?_0x16813e['options'][_0xc61b('0x19')]||null:null,'attributes':_0x16813e[_0xc61b('0x18')]?_0x16813e[_0xc61b('0x18')][_0xc61b('0x1a')]||null:null,'limit':_0x16813e['options']?_0x16813e['options'][_0xc61b('0x1b')]||null:null,'include':_0x16813e[_0xc61b('0x18')]?_0x16813e[_0xc61b('0x18')][_0xc61b('0x1c')]?_[_0xc61b('0x1d')](_0x16813e[_0xc61b('0x18')][_0xc61b('0x1c')],function(_0x1b4f24){return{'model':db[_0x1b4f24[_0xc61b('0x1e')]],'as':_0x1b4f24['as'],'attributes':_0x1b4f24[_0xc61b('0x1a')],'include':_0x1b4f24['include']?_[_0xc61b('0x1d')](_0x1b4f24[_0xc61b('0x1c')],function(_0x54021c){return{'model':db[_0x54021c[_0xc61b('0x1e')]],'as':_0x54021c['as'],'attributes':_0x54021c[_0xc61b('0x1a')],'include':_0x54021c['include']?_[_0xc61b('0x1d')](_0x54021c['include'],function(_0x23c10c){return{'model':db[_0x23c10c[_0xc61b('0x1e')]],'as':_0x23c10c['as'],'attributes':_0x23c10c[_0xc61b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc61b('0xb')](function(_0x1c3e8c){logger[_0xc61b('0xc')]('GetMemberReport',_0x16813e);logger['debug'](_0xc61b('0x16'),_0x16813e,JSON[_0xc61b('0x10')](_0x1c3e8c));_0x335320(_0x1c3e8c);})[_0xc61b('0x15')](function(_0x33b694){logger[_0xc61b('0x11')](_0xc61b('0x16'),_0x33b694[_0xc61b('0x13')],_0x16813e);_0x497bbe(_0x479c6b[_0xc61b('0x11')](0x1f4,_0x33b694[_0xc61b('0x13')]));});});};exports[_0xc61b('0x1f')]=function(_0x5258c0){var _0x257b43=this;return new Promise(function(_0x38463b,_0x37c773){return db[_0xc61b('0x17')][_0xc61b('0x20')](_0x5258c0[_0xc61b('0x21')],{'raw':_0x5258c0['options']?_0x5258c0[_0xc61b('0x18')][_0xc61b('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x284f89){logger['info'](_0xc61b('0x1f'),_0x5258c0);logger[_0xc61b('0xf')](_0xc61b('0x1f'),_0x5258c0,JSON[_0xc61b('0x10')](_0x284f89));_0x38463b(_0x284f89);})[_0xc61b('0x15')](function(_0x58e7f9){logger['error'](_0xc61b('0x1f'),_0x58e7f9['message'],_0x5258c0);_0x37c773(_0x257b43[_0xc61b('0x11')](0x1f4,_0x58e7f9[_0xc61b('0x13')]));});});};exports[_0xc61b('0x23')]=function(_0x36bf8f){var _0x5031f9=this;return new Promise(function(_0x18527a,_0x2b670d){return db[_0xc61b('0x17')][_0xc61b('0x24')](_0x36bf8f[_0xc61b('0x21')],{'raw':_0x36bf8f[_0xc61b('0x18')]?_0x36bf8f[_0xc61b('0x18')][_0xc61b('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36bf8f[_0xc61b('0x18')]?_0x36bf8f[_0xc61b('0x18')][_0xc61b('0x19')]||null:null,'attributes':_0x36bf8f['options']?_0x36bf8f[_0xc61b('0x18')][_0xc61b('0x1a')]||null:null,'limit':_0x36bf8f['options']?_0x36bf8f[_0xc61b('0x18')]['limit']||null:null})['then'](function(_0x37165e){logger[_0xc61b('0xc')](_0xc61b('0x23'),_0x36bf8f);logger[_0xc61b('0xf')]('UpdateMemberReport',_0x36bf8f,JSON[_0xc61b('0x10')](_0x37165e));_0x18527a(_0x37165e);})[_0xc61b('0x15')](function(_0x271e7e){logger[_0xc61b('0x11')](_0xc61b('0x23'),_0x271e7e['message'],_0x36bf8f);_0x2b670d(_0x5031f9[_0xc61b('0x11')](0x1f4,_0x271e7e['message']));});});};