Built motion from commit (unavailable).|2.5.0
[motion2.git] / server / api / memberReport / memberReport.controller.js
index d91fd74..db04d5a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3458=['key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','end','error','stack','name','send','index','map','MemberReport','rawAttributes','type'];(function(_0x21adbd,_0x16d384){var _0x4ffb9e=function(_0x15fbf6){while(--_0x15fbf6){_0x21adbd['push'](_0x21adbd['shift']());}};_0x4ffb9e(++_0x16d384);}(_0x3458,0xbc));var _0x8345=function(_0x379825,_0x57af4a){_0x379825=_0x379825-0x0;var _0xfcc221=_0x3458[_0x379825];return _0xfcc221;};'use strict';var pdf=require(_0x8345('0x0'));var emlformat=require(_0x8345('0x1'));var rimraf=require(_0x8345('0x2'));var zipdir=require(_0x8345('0x3'));var jsonpatch=require(_0x8345('0x4'));var rp=require('request-promise');var moment=require(_0x8345('0x5'));var BPromise=require(_0x8345('0x6'));var Mustache=require(_0x8345('0x7'));var util=require(_0x8345('0x8'));var path=require(_0x8345('0x9'));var sox=require('sox');var csv=require(_0x8345('0xa'));var ejs=require(_0x8345('0xb'));var fs=require('fs');var _=require(_0x8345('0xc'));var squel=require(_0x8345('0xd'));var crypto=require(_0x8345('0xe'));var jsforce=require(_0x8345('0xf'));var deskjs=require(_0x8345('0x10'));var toCsv=require(_0x8345('0xa'));var querystring=require(_0x8345('0x11'));var Papa=require(_0x8345('0x12'));var Redis=require('ioredis');var authService=require(_0x8345('0x13'));var qs=require(_0x8345('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8345('0x15'));var logger=require(_0x8345('0x16'))(_0x8345('0x17'));var utils=require(_0x8345('0x18'));var config=require(_0x8345('0x19'));var db=require(_0x8345('0x1a'))['db'];function respondWithStatusCode(_0x5e6919,_0x53c43d){_0x53c43d=_0x53c43d||0xcc;return function(_0x19efb5){if(_0x19efb5){return _0x5e6919[_0x8345('0x1b')](_0x53c43d);}return _0x5e6919[_0x8345('0x1c')](_0x53c43d)['end']();};}function respondWithResult(_0x5465fe,_0x1cf165){_0x1cf165=_0x1cf165||0xc8;return function(_0x20b84){if(_0x20b84){return _0x5465fe[_0x8345('0x1c')](_0x1cf165)['json'](_0x20b84);}};}function respondWithFilteredResult(_0x39beb6,_0x55615c){return function(_0x233820){if(_0x233820){var _0x307251=_0x233820[_0x8345('0x1d')],_0x2ecc1d=_0x55615c[_0x8345('0x1e')],_0x3d6c77=_0x55615c[_0x8345('0x1e')]+_0x55615c[_0x8345('0x1f')],_0x3aa53c;if(_0x3d6c77>=_0x307251){_0x3d6c77=_0x307251;_0x3aa53c=0xc8;}else{_0x3aa53c=0xce;}_0x39beb6[_0x8345('0x1c')](_0x3aa53c);return _0x39beb6[_0x8345('0x20')](_0x8345('0x21'),_0x2ecc1d+'-'+_0x3d6c77+'/'+_0x307251)[_0x8345('0x22')](_0x233820);}return null;};}function patchUpdates(_0x50acf2){return function(_0x399cb3){try{jsonpatch[_0x8345('0x23')](_0x399cb3,_0x50acf2,!![]);}catch(_0x2c1e96){return BPromise['reject'](_0x2c1e96);}return _0x399cb3[_0x8345('0x24')]();};}function saveUpdates(_0x12a845,_0x894623){return function(_0xcb32cf){if(_0xcb32cf){return _0xcb32cf['update'](_0x12a845)[_0x8345('0x25')](function(_0x3883eb){return _0x3883eb;});}return null;};}function removeEntity(_0x539149,_0x26ed7e){return function(_0x292e7a){if(_0x292e7a){return _0x292e7a[_0x8345('0x26')]()[_0x8345('0x25')](function(){_0x539149[_0x8345('0x1c')](0xcc)[_0x8345('0x27')]();});}};}function handleEntityNotFound(_0xaf3d1c,_0x5360ac){return function(_0x13984d){if(!_0x13984d){_0xaf3d1c[_0x8345('0x1b')](0x194);}return _0x13984d;};}function handleError(_0x444fb1,_0x409aa0){_0x409aa0=_0x409aa0||0x1f4;return function(_0x372f4a){logger[_0x8345('0x28')](_0x372f4a[_0x8345('0x29')]);if(_0x372f4a[_0x8345('0x2a')]){delete _0x372f4a[_0x8345('0x2a')];}_0x444fb1[_0x8345('0x1c')](_0x409aa0)[_0x8345('0x2b')](_0x372f4a);};}exports[_0x8345('0x2c')]=function(_0x4e67d5,_0x22bfa5){var _0x2ef610={},_0x151451={},_0x3ac2bf={'count':0x0,'rows':[]};var _0x588f8f=_[_0x8345('0x2d')](db[_0x8345('0x2e')][_0x8345('0x2f')],function(_0x26e69c){return{'name':_0x26e69c['fieldName'],'type':_0x26e69c[_0x8345('0x30')][_0x8345('0x31')]};});_0x151451[_0x8345('0x32')]=_[_0x8345('0x2d')](_0x588f8f,_0x8345('0x2a'));_0x151451[_0x8345('0x33')]=_[_0x8345('0x34')](_0x4e67d5[_0x8345('0x33')]);_0x151451[_0x8345('0x35')]=_['intersection'](_0x151451[_0x8345('0x32')],_0x151451[_0x8345('0x33')]);_0x2ef610[_0x8345('0x36')]=_[_0x8345('0x37')](_0x151451['model'],qs['fields'](_0x4e67d5[_0x8345('0x33')][_0x8345('0x38')]));_0x2ef610[_0x8345('0x36')]=_0x2ef610[_0x8345('0x36')][_0x8345('0x39')]?_0x2ef610['attributes']:_0x151451[_0x8345('0x32')];if(!_0x4e67d5[_0x8345('0x33')][_0x8345('0x3a')]('nolimit')){_0x2ef610[_0x8345('0x1f')]=qs[_0x8345('0x1f')](_0x4e67d5[_0x8345('0x33')][_0x8345('0x1f')]);_0x2ef610['offset']=qs['offset'](_0x4e67d5[_0x8345('0x33')][_0x8345('0x1e')]);}_0x2ef610[_0x8345('0x3b')]=qs[_0x8345('0x3c')](_0x4e67d5[_0x8345('0x33')][_0x8345('0x3c')]);_0x2ef610['where']=qs[_0x8345('0x35')](_[_0x8345('0x3d')](_0x4e67d5[_0x8345('0x33')],_0x151451[_0x8345('0x35')]));if(_0x4e67d5['query'][_0x8345('0x3e')]){_0x2ef610[_0x8345('0x3f')]=_[_0x8345('0x40')](_0x2ef610[_0x8345('0x3f')],{'$or':_[_0x8345('0x2d')](_0x588f8f,function(_0x5b93a0){if(_0x5b93a0[_0x8345('0x30')]!==_0x8345('0x41')){var _0x14bf7e={};_0x14bf7e[_0x5b93a0['name']]={'$like':'%'+_0x4e67d5[_0x8345('0x33')]['filter']+'%'};return _0x14bf7e;}})});}_0x2ef610=_[_0x8345('0x40')]({},_0x2ef610,_0x4e67d5['options']);var _0x149bd9={'where':_0x2ef610['where']};return db[_0x8345('0x2e')]['count'](_0x149bd9)[_0x8345('0x25')](function(_0x28fb92){_0x3ac2bf['count']=_0x28fb92;if(_0x4e67d5[_0x8345('0x33')][_0x8345('0x42')]){_0x2ef610[_0x8345('0x43')]=[{'all':!![]}];}return db[_0x8345('0x2e')][_0x8345('0x44')](_0x2ef610);})[_0x8345('0x25')](function(_0xa0548){_0x3ac2bf[_0x8345('0x45')]=_0xa0548;return _0x3ac2bf;})[_0x8345('0x25')](respondWithFilteredResult(_0x22bfa5,_0x2ef610))['catch'](handleError(_0x22bfa5,null));};exports[_0x8345('0x46')]=function(_0x4cbd57,_0x15b5c4){var _0x1d34c6={'raw':!![],'where':{'id':_0x4cbd57[_0x8345('0x47')]['id']}},_0x30e909={};_0x30e909['model']=_[_0x8345('0x34')](db[_0x8345('0x2e')][_0x8345('0x2f')]);_0x30e909[_0x8345('0x33')]=_[_0x8345('0x34')](_0x4cbd57[_0x8345('0x33')]);_0x30e909[_0x8345('0x35')]=_[_0x8345('0x37')](_0x30e909['model'],_0x30e909[_0x8345('0x33')]);_0x1d34c6[_0x8345('0x36')]=_[_0x8345('0x37')](_0x30e909[_0x8345('0x32')],qs[_0x8345('0x38')](_0x4cbd57[_0x8345('0x33')][_0x8345('0x38')]));_0x1d34c6['attributes']=_0x1d34c6[_0x8345('0x36')]['length']?_0x1d34c6[_0x8345('0x36')]:_0x30e909[_0x8345('0x32')];if(_0x4cbd57['query'][_0x8345('0x42')]){_0x1d34c6[_0x8345('0x43')]=[{'all':!![]}];}_0x1d34c6=_[_0x8345('0x40')]({},_0x1d34c6,_0x4cbd57[_0x8345('0x48')]);return db[_0x8345('0x2e')][_0x8345('0x49')](_0x1d34c6)[_0x8345('0x25')](handleEntityNotFound(_0x15b5c4,null))[_0x8345('0x25')](respondWithResult(_0x15b5c4,null))[_0x8345('0x4a')](handleError(_0x15b5c4,null));};exports['create']=function(_0x3c7805,_0x57e1dc){return db['MemberReport'][_0x8345('0x4b')](_0x3c7805[_0x8345('0x4c')],{})['then'](respondWithResult(_0x57e1dc,0xc9))['catch'](handleError(_0x57e1dc,null));};exports[_0x8345('0x4d')]=function(_0x2113fa,_0x4111c0){if(_0x2113fa[_0x8345('0x4c')]['id']){delete _0x2113fa['body']['id'];}return db[_0x8345('0x2e')][_0x8345('0x49')]({'where':{'id':_0x2113fa['params']['id']}})['then'](handleEntityNotFound(_0x4111c0,null))[_0x8345('0x25')](saveUpdates(_0x2113fa[_0x8345('0x4c')],null))[_0x8345('0x25')](respondWithResult(_0x4111c0,null))['catch'](handleError(_0x4111c0,null));};exports[_0x8345('0x26')]=function(_0x10a6f8,_0x14f03b){return db[_0x8345('0x2e')][_0x8345('0x49')]({'where':{'id':_0x10a6f8[_0x8345('0x47')]['id']}})[_0x8345('0x25')](handleEntityNotFound(_0x14f03b,null))[_0x8345('0x25')](removeEntity(_0x14f03b,null))[_0x8345('0x4a')](handleError(_0x14f03b,null));};exports['describe']=function(_0x51ad73,_0x3670c4){return db[_0x8345('0x2e')][_0x8345('0x4e')]()[_0x8345('0x25')](respondWithResult(_0x3670c4,null))[_0x8345('0x4a')](handleError(_0x3670c4,null));};
\ No newline at end of file
+var _0x0f96=['options','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','send','map','MemberReport','fieldName','key','model','name','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL'];(function(_0x299446,_0x202cf7){var _0x5bd7d8=function(_0x77cbcc){while(--_0x77cbcc){_0x299446['push'](_0x299446['shift']());}};_0x5bd7d8(++_0x202cf7);}(_0x0f96,0xda));var _0x60f9=function(_0x474849,_0x5e4ea6){_0x474849=_0x474849-0x0;var _0x5a5401=_0x0f96[_0x474849];return _0x5a5401;};'use strict';var pdf=require(_0x60f9('0x0'));var emlformat=require(_0x60f9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x60f9('0x2'));var rp=require(_0x60f9('0x3'));var moment=require(_0x60f9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x60f9('0x5'));var path=require(_0x60f9('0x6'));var sox=require('sox');var csv=require(_0x60f9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x60f9('0x8'));var squel=require(_0x60f9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x60f9('0x7'));var querystring=require(_0x60f9('0xa'));var Papa=require(_0x60f9('0xb'));var Redis=require(_0x60f9('0xc'));var authService=require(_0x60f9('0xd'));var qs=require(_0x60f9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x60f9('0xf'))('api');var utils=require(_0x60f9('0x10'));var config=require(_0x60f9('0x11'));var db=require(_0x60f9('0x12'))['db'];function respondWithStatusCode(_0xc2159e,_0x50d8e7){_0x50d8e7=_0x50d8e7||0xcc;return function(_0x39f641){if(_0x39f641){return _0xc2159e[_0x60f9('0x13')](_0x50d8e7);}return _0xc2159e[_0x60f9('0x14')](_0x50d8e7)['end']();};}function respondWithResult(_0x14c058,_0x306420){_0x306420=_0x306420||0xc8;return function(_0x4f86f2){if(_0x4f86f2){return _0x14c058[_0x60f9('0x14')](_0x306420)['json'](_0x4f86f2);}};}function respondWithFilteredResult(_0x524fd5,_0x300985){return function(_0x22cd1c){if(_0x22cd1c){var _0x8bf553=_0x22cd1c[_0x60f9('0x15')],_0x10656b=_0x300985[_0x60f9('0x16')],_0x400395=_0x300985['offset']+_0x300985[_0x60f9('0x17')],_0x2ef925;if(_0x400395>=_0x8bf553){_0x400395=_0x8bf553;_0x2ef925=0xc8;}else{_0x2ef925=0xce;}_0x524fd5[_0x60f9('0x14')](_0x2ef925);return _0x524fd5[_0x60f9('0x18')](_0x60f9('0x19'),_0x10656b+'-'+_0x400395+'/'+_0x8bf553)[_0x60f9('0x1a')](_0x22cd1c);}return null;};}function patchUpdates(_0x735cf0){return function(_0x405967){try{jsonpatch[_0x60f9('0x1b')](_0x405967,_0x735cf0,!![]);}catch(_0x3edba5){return BPromise[_0x60f9('0x1c')](_0x3edba5);}return _0x405967[_0x60f9('0x1d')]();};}function saveUpdates(_0x20822c,_0x3ca065){return function(_0xae1d42){if(_0xae1d42){return _0xae1d42[_0x60f9('0x1e')](_0x20822c)['then'](function(_0x25a8d9){return _0x25a8d9;});}return null;};}function removeEntity(_0x3ecc34,_0x18ff98){return function(_0x50445d){if(_0x50445d){return _0x50445d[_0x60f9('0x1f')]()[_0x60f9('0x20')](function(){_0x3ecc34[_0x60f9('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18cf65,_0x4cfdd9){return function(_0x4fce3b){if(!_0x4fce3b){_0x18cf65[_0x60f9('0x13')](0x194);}return _0x4fce3b;};}function handleError(_0x37573a,_0x506a98){_0x506a98=_0x506a98||0x1f4;return function(_0x33287c){logger[_0x60f9('0x21')](_0x33287c[_0x60f9('0x22')]);if(_0x33287c['name']){delete _0x33287c['name'];}_0x37573a[_0x60f9('0x14')](_0x506a98)[_0x60f9('0x23')](_0x33287c);};}exports['index']=function(_0x448645,_0x33c632){var _0x1ac4c1={},_0x2256b9={},_0x30b4f6={'count':0x0,'rows':[]};var _0x478c50=_[_0x60f9('0x24')](db[_0x60f9('0x25')]['rawAttributes'],function(_0x1b7b8b){return{'name':_0x1b7b8b[_0x60f9('0x26')],'type':_0x1b7b8b['type'][_0x60f9('0x27')]};});_0x2256b9[_0x60f9('0x28')]=_[_0x60f9('0x24')](_0x478c50,_0x60f9('0x29'));_0x2256b9['query']=_[_0x60f9('0x2a')](_0x448645[_0x60f9('0x2b')]);_0x2256b9['filters']=_['intersection'](_0x2256b9[_0x60f9('0x28')],_0x2256b9[_0x60f9('0x2b')]);_0x1ac4c1[_0x60f9('0x2c')]=_[_0x60f9('0x2d')](_0x2256b9['model'],qs[_0x60f9('0x2e')](_0x448645[_0x60f9('0x2b')][_0x60f9('0x2e')]));_0x1ac4c1[_0x60f9('0x2c')]=_0x1ac4c1[_0x60f9('0x2c')][_0x60f9('0x2f')]?_0x1ac4c1[_0x60f9('0x2c')]:_0x2256b9[_0x60f9('0x28')];if(!_0x448645[_0x60f9('0x2b')][_0x60f9('0x30')](_0x60f9('0x31'))){_0x1ac4c1[_0x60f9('0x17')]=qs['limit'](_0x448645[_0x60f9('0x2b')][_0x60f9('0x17')]);_0x1ac4c1[_0x60f9('0x16')]=qs['offset'](_0x448645[_0x60f9('0x2b')][_0x60f9('0x16')]);}_0x1ac4c1[_0x60f9('0x32')]=qs[_0x60f9('0x33')](_0x448645[_0x60f9('0x2b')][_0x60f9('0x33')]);_0x1ac4c1[_0x60f9('0x34')]=qs[_0x60f9('0x35')](_['pick'](_0x448645['query'],_0x2256b9['filters']));if(_0x448645[_0x60f9('0x2b')][_0x60f9('0x36')]){_0x1ac4c1['where']=_[_0x60f9('0x37')](_0x1ac4c1[_0x60f9('0x34')],{'$or':_[_0x60f9('0x24')](_0x478c50,function(_0x332f86){if(_0x332f86[_0x60f9('0x38')]!==_0x60f9('0x39')){var _0x387e56={};_0x387e56[_0x332f86['name']]={'$like':'%'+_0x448645[_0x60f9('0x2b')]['filter']+'%'};return _0x387e56;}})});}_0x1ac4c1=_['merge']({},_0x1ac4c1,_0x448645[_0x60f9('0x3a')]);var _0x2d118e={'where':_0x1ac4c1[_0x60f9('0x34')]};return db[_0x60f9('0x25')][_0x60f9('0x15')](_0x2d118e)[_0x60f9('0x20')](function(_0x1f62f2){_0x30b4f6[_0x60f9('0x15')]=_0x1f62f2;if(_0x448645[_0x60f9('0x2b')]['includeAll']){_0x1ac4c1['include']=[{'all':!![]}];}return db['MemberReport'][_0x60f9('0x3b')](_0x1ac4c1);})['then'](function(_0x2843cd){_0x30b4f6[_0x60f9('0x3c')]=_0x2843cd;return _0x30b4f6;})[_0x60f9('0x20')](respondWithFilteredResult(_0x33c632,_0x1ac4c1))[_0x60f9('0x3d')](handleError(_0x33c632,null));};exports[_0x60f9('0x3e')]=function(_0x44450f,_0x1e2f6f){var _0x4d8184={'raw':!![],'where':{'id':_0x44450f['params']['id']}},_0x30691a={};_0x30691a[_0x60f9('0x28')]=_[_0x60f9('0x2a')](db[_0x60f9('0x25')][_0x60f9('0x3f')]);_0x30691a[_0x60f9('0x2b')]=_[_0x60f9('0x2a')](_0x44450f[_0x60f9('0x2b')]);_0x30691a[_0x60f9('0x35')]=_[_0x60f9('0x2d')](_0x30691a[_0x60f9('0x28')],_0x30691a[_0x60f9('0x2b')]);_0x4d8184[_0x60f9('0x2c')]=_['intersection'](_0x30691a[_0x60f9('0x28')],qs[_0x60f9('0x2e')](_0x44450f[_0x60f9('0x2b')][_0x60f9('0x2e')]));_0x4d8184[_0x60f9('0x2c')]=_0x4d8184[_0x60f9('0x2c')]['length']?_0x4d8184[_0x60f9('0x2c')]:_0x30691a[_0x60f9('0x28')];if(_0x44450f[_0x60f9('0x2b')]['includeAll']){_0x4d8184[_0x60f9('0x40')]=[{'all':!![]}];}_0x4d8184=_['merge']({},_0x4d8184,_0x44450f[_0x60f9('0x3a')]);return db[_0x60f9('0x25')][_0x60f9('0x41')](_0x4d8184)['then'](handleEntityNotFound(_0x1e2f6f,null))[_0x60f9('0x20')](respondWithResult(_0x1e2f6f,null))[_0x60f9('0x3d')](handleError(_0x1e2f6f,null));};exports[_0x60f9('0x42')]=function(_0x3c18e6,_0x3ae134){return db[_0x60f9('0x25')][_0x60f9('0x42')](_0x3c18e6[_0x60f9('0x43')],{})[_0x60f9('0x20')](respondWithResult(_0x3ae134,0xc9))['catch'](handleError(_0x3ae134,null));};exports[_0x60f9('0x1e')]=function(_0x3e640a,_0x540dfc){if(_0x3e640a['body']['id']){delete _0x3e640a[_0x60f9('0x43')]['id'];}return db[_0x60f9('0x25')][_0x60f9('0x41')]({'where':{'id':_0x3e640a[_0x60f9('0x44')]['id']}})[_0x60f9('0x20')](handleEntityNotFound(_0x540dfc,null))[_0x60f9('0x20')](saveUpdates(_0x3e640a[_0x60f9('0x43')],null))[_0x60f9('0x20')](respondWithResult(_0x540dfc,null))['catch'](handleError(_0x540dfc,null));};exports[_0x60f9('0x1f')]=function(_0x3804f2,_0x1d8cd4){return db['MemberReport']['find']({'where':{'id':_0x3804f2[_0x60f9('0x44')]['id']}})[_0x60f9('0x20')](handleEntityNotFound(_0x1d8cd4,null))[_0x60f9('0x20')](removeEntity(_0x1d8cd4,null))[_0x60f9('0x3d')](handleError(_0x1d8cd4,null));};exports['describe']=function(_0x4016fa,_0x424dc8){return db[_0x60f9('0x25')]['describe']()[_0x60f9('0x20')](respondWithResult(_0x424dc8,null))[_0x60f9('0x3d')](handleError(_0x424dc8,null));};
\ No newline at end of file