Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / api / squareReportDetail / squareReportDetail.controller.js
index 4d6098f..8d53fc6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8b89=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','error','stack','name','send','map','SquareDetailsReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','catch','show','params','keys','rawAttributes','find','create','body','destroy','html-pdf','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8b89,0x107));var _0x98b8=function(_0x5e6a94,_0x126298){_0x5e6a94=_0x5e6a94-0x0;var _0x3304c6=_0x8b89[_0x5e6a94];return _0x3304c6;};'use strict';var pdf=require(_0x98b8('0x0'));var emlformat=require(_0x98b8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x98b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98b8('0x3'));var moment=require(_0x98b8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x98b8('0x5'));var path=require('path');var sox=require(_0x98b8('0x6'));var csv=require(_0x98b8('0x7'));var ejs=require(_0x98b8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x98b8('0x9'));var jsforce=require(_0x98b8('0xa'));var deskjs=require(_0x98b8('0xb'));var toCsv=require(_0x98b8('0x7'));var querystring=require(_0x98b8('0xc'));var Papa=require(_0x98b8('0xd'));var Redis=require(_0x98b8('0xe'));var authService=require(_0x98b8('0xf'));var qs=require(_0x98b8('0x10'));var as=require(_0x98b8('0x11'));var hardwareService=require(_0x98b8('0x12'));var logger=require(_0x98b8('0x13'))(_0x98b8('0x14'));var utils=require(_0x98b8('0x15'));var config=require('../../config/environment');var db=require(_0x98b8('0x16'))['db'];function respondWithStatusCode(_0x5d85f7,_0x3dd456){_0x3dd456=_0x3dd456||0xcc;return function(_0x367a52){if(_0x367a52){return _0x5d85f7[_0x98b8('0x17')](_0x3dd456);}return _0x5d85f7[_0x98b8('0x18')](_0x3dd456)['end']();};}function respondWithResult(_0xddf327,_0x3f24d3){_0x3f24d3=_0x3f24d3||0xc8;return function(_0x40047f){if(_0x40047f){return _0xddf327['status'](_0x3f24d3)[_0x98b8('0x19')](_0x40047f);}};}function respondWithFilteredResult(_0x525f07,_0x4fa35c){return function(_0x34b1d3){if(_0x34b1d3){var _0x163d62=_0x34b1d3[_0x98b8('0x1a')],_0x3b6399=_0x4fa35c['offset'],_0x325a91=_0x4fa35c[_0x98b8('0x1b')]+_0x4fa35c[_0x98b8('0x1c')],_0x57c518;if(_0x325a91>=_0x163d62){_0x325a91=_0x163d62;_0x57c518=0xc8;}else{_0x57c518=0xce;}_0x525f07[_0x98b8('0x18')](_0x57c518);return _0x525f07[_0x98b8('0x1d')]('Content-Range',_0x3b6399+'-'+_0x325a91+'/'+_0x163d62)[_0x98b8('0x19')](_0x34b1d3);}return null;};}function patchUpdates(_0xd8db10){return function(_0x340565){try{jsonpatch[_0x98b8('0x1e')](_0x340565,_0xd8db10,!![]);}catch(_0x302993){return BPromise[_0x98b8('0x1f')](_0x302993);}return _0x340565['save']();};}function saveUpdates(_0x59ac27,_0x2ecec0){return function(_0x4079e0){if(_0x4079e0){return _0x4079e0[_0x98b8('0x20')](_0x59ac27)[_0x98b8('0x21')](function(_0x3b544d){return _0x3b544d;});}return null;};}function removeEntity(_0x409825,_0x4787bb){return function(_0x137b76){if(_0x137b76){return _0x137b76['destroy']()['then'](function(){_0x409825[_0x98b8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38cfd0,_0xbde2ef){return function(_0x59c020){if(!_0x59c020){_0x38cfd0[_0x98b8('0x17')](0x194);}return _0x59c020;};}function handleError(_0x570021,_0xb566f7){_0xb566f7=_0xb566f7||0x1f4;return function(_0x5854e2){logger[_0x98b8('0x22')](_0x5854e2[_0x98b8('0x23')]);if(_0x5854e2[_0x98b8('0x24')]){delete _0x5854e2[_0x98b8('0x24')];}_0x570021[_0x98b8('0x18')](_0xb566f7)[_0x98b8('0x25')](_0x5854e2);};}exports['index']=function(_0x1f65d7,_0xa8d0c8){var _0x5091b7={},_0x1fd662={},_0x46013e={'count':0x0,'rows':[]};var _0x1f9a4d=_[_0x98b8('0x26')](db[_0x98b8('0x27')]['rawAttributes'],function(_0x4ac783){return{'name':_0x4ac783[_0x98b8('0x28')],'type':_0x4ac783[_0x98b8('0x29')][_0x98b8('0x2a')]};});_0x1fd662[_0x98b8('0x2b')]=_[_0x98b8('0x26')](_0x1f9a4d,_0x98b8('0x24'));_0x1fd662[_0x98b8('0x2c')]=_['keys'](_0x1f65d7[_0x98b8('0x2c')]);_0x1fd662[_0x98b8('0x2d')]=_[_0x98b8('0x2e')](_0x1fd662[_0x98b8('0x2b')],_0x1fd662['query']);_0x5091b7['attributes']=_['intersection'](_0x1fd662[_0x98b8('0x2b')],qs[_0x98b8('0x2f')](_0x1f65d7['query'][_0x98b8('0x2f')]));_0x5091b7[_0x98b8('0x30')]=_0x5091b7['attributes'][_0x98b8('0x31')]?_0x5091b7[_0x98b8('0x30')]:_0x1fd662[_0x98b8('0x2b')];if(!_0x1f65d7['query'][_0x98b8('0x32')](_0x98b8('0x33'))){_0x5091b7[_0x98b8('0x1c')]=qs[_0x98b8('0x1c')](_0x1f65d7[_0x98b8('0x2c')]['limit']);_0x5091b7[_0x98b8('0x1b')]=qs[_0x98b8('0x1b')](_0x1f65d7[_0x98b8('0x2c')][_0x98b8('0x1b')]);}_0x5091b7[_0x98b8('0x34')]=qs[_0x98b8('0x35')](_0x1f65d7[_0x98b8('0x2c')][_0x98b8('0x35')]);_0x5091b7[_0x98b8('0x36')]=qs[_0x98b8('0x2d')](_['pick'](_0x1f65d7[_0x98b8('0x2c')],_0x1fd662[_0x98b8('0x2d')]),_0x1f9a4d);if(_0x1f65d7['query'][_0x98b8('0x37')]){_0x5091b7[_0x98b8('0x36')]=_['merge'](_0x5091b7[_0x98b8('0x36')],{'$or':_[_0x98b8('0x26')](_0x1f9a4d,function(_0x526871){if(_0x526871[_0x98b8('0x29')]!=='VIRTUAL'){var _0x3fb98e={};_0x3fb98e[_0x526871[_0x98b8('0x24')]]={'$like':'%'+_0x1f65d7[_0x98b8('0x2c')][_0x98b8('0x37')]+'%'};return _0x3fb98e;}})});}_0x5091b7=_[_0x98b8('0x38')]({},_0x5091b7,_0x1f65d7[_0x98b8('0x39')]);var _0x5c4545={'where':_0x5091b7['where']};return db[_0x98b8('0x27')]['count'](_0x5c4545)[_0x98b8('0x21')](function(_0x1980c4){_0x46013e[_0x98b8('0x1a')]=_0x1980c4;if(_0x1f65d7[_0x98b8('0x2c')][_0x98b8('0x3a')]){_0x5091b7[_0x98b8('0x3b')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x5091b7);})[_0x98b8('0x21')](function(_0x1293e){_0x46013e['rows']=_0x1293e;return _0x46013e;})[_0x98b8('0x21')](respondWithFilteredResult(_0xa8d0c8,_0x5091b7))[_0x98b8('0x3c')](handleError(_0xa8d0c8,null));};exports[_0x98b8('0x3d')]=function(_0x414f92,_0x14735c){var _0x560910={'raw':!![],'where':{'id':_0x414f92[_0x98b8('0x3e')]['id']}},_0x227edf={};_0x227edf['model']=_[_0x98b8('0x3f')](db[_0x98b8('0x27')][_0x98b8('0x40')]);_0x227edf[_0x98b8('0x2c')]=_[_0x98b8('0x3f')](_0x414f92[_0x98b8('0x2c')]);_0x227edf['filters']=_[_0x98b8('0x2e')](_0x227edf[_0x98b8('0x2b')],_0x227edf['query']);_0x560910[_0x98b8('0x30')]=_[_0x98b8('0x2e')](_0x227edf[_0x98b8('0x2b')],qs[_0x98b8('0x2f')](_0x414f92[_0x98b8('0x2c')][_0x98b8('0x2f')]));_0x560910[_0x98b8('0x30')]=_0x560910[_0x98b8('0x30')][_0x98b8('0x31')]?_0x560910[_0x98b8('0x30')]:_0x227edf['model'];if(_0x414f92[_0x98b8('0x2c')][_0x98b8('0x3a')]){_0x560910[_0x98b8('0x3b')]=[{'all':!![]}];}_0x560910=_[_0x98b8('0x38')]({},_0x560910,_0x414f92[_0x98b8('0x39')]);return db['SquareDetailsReport'][_0x98b8('0x41')](_0x560910)['then'](handleEntityNotFound(_0x14735c,null))[_0x98b8('0x21')](respondWithResult(_0x14735c,null))['catch'](handleError(_0x14735c,null));};exports[_0x98b8('0x42')]=function(_0x560837,_0x41678c){return db[_0x98b8('0x27')][_0x98b8('0x42')](_0x560837[_0x98b8('0x43')],{})[_0x98b8('0x21')](respondWithResult(_0x41678c,0xc9))['catch'](handleError(_0x41678c,null));};exports[_0x98b8('0x20')]=function(_0x48de65,_0x422dc7){if(_0x48de65['body']['id']){delete _0x48de65[_0x98b8('0x43')]['id'];}return db[_0x98b8('0x27')][_0x98b8('0x41')]({'where':{'id':_0x48de65[_0x98b8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x422dc7,null))[_0x98b8('0x21')](saveUpdates(_0x48de65['body'],null))['then'](respondWithResult(_0x422dc7,null))[_0x98b8('0x3c')](handleError(_0x422dc7,null));};exports[_0x98b8('0x44')]=function(_0x417bd4,_0x545bab){return db[_0x98b8('0x27')]['find']({'where':{'id':_0x417bd4[_0x98b8('0x3e')]['id']}})[_0x98b8('0x21')](handleEntityNotFound(_0x545bab,null))[_0x98b8('0x21')](removeEntity(_0x545bab,null))[_0x98b8('0x3c')](handleError(_0x545bab,null));};exports['describe']=function(_0xa7c422,_0x363a91){return db[_0x98b8('0x27')]['describe']()[_0x98b8('0x21')](respondWithResult(_0x363a91,null))[_0x98b8('0x3c')](handleError(_0x363a91,null));};
\ No newline at end of file
+var _0x21a8=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','status','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','describe','html-pdf','eml-format','rimraf'];(function(_0x3399bb,_0x5e7c53){var _0x1afd51=function(_0x463f5f){while(--_0x463f5f){_0x3399bb['push'](_0x3399bb['shift']());}};_0x1afd51(++_0x5e7c53);}(_0x21a8,0xed));var _0x821a=function(_0x20118f,_0xcc6843){_0x20118f=_0x20118f-0x0;var _0x145703=_0x21a8[_0x20118f];return _0x145703;};'use strict';var pdf=require(_0x821a('0x0'));var emlformat=require(_0x821a('0x1'));var rimraf=require(_0x821a('0x2'));var zipdir=require(_0x821a('0x3'));var jsonpatch=require(_0x821a('0x4'));var rp=require(_0x821a('0x5'));var moment=require(_0x821a('0x6'));var BPromise=require(_0x821a('0x7'));var Mustache=require(_0x821a('0x8'));var util=require('util');var path=require(_0x821a('0x9'));var sox=require(_0x821a('0xa'));var csv=require(_0x821a('0xb'));var ejs=require(_0x821a('0xc'));var fs=require('fs');var _=require(_0x821a('0xd'));var squel=require(_0x821a('0xe'));var crypto=require(_0x821a('0xf'));var jsforce=require(_0x821a('0x10'));var deskjs=require(_0x821a('0x11'));var toCsv=require(_0x821a('0xb'));var querystring=require(_0x821a('0x12'));var Papa=require(_0x821a('0x13'));var Redis=require(_0x821a('0x14'));var authService=require(_0x821a('0x15'));var qs=require(_0x821a('0x16'));var as=require(_0x821a('0x17'));var hardwareService=require(_0x821a('0x18'));var logger=require(_0x821a('0x19'))(_0x821a('0x1a'));var utils=require(_0x821a('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x821a('0x1c'));var db=require(_0x821a('0x1d'))['db'];function respondWithStatusCode(_0x33c39c,_0x348663){_0x348663=_0x348663||0xcc;return function(_0x3ae0a8){if(_0x3ae0a8){return _0x33c39c[_0x821a('0x1e')](_0x348663);}return _0x33c39c['status'](_0x348663)[_0x821a('0x1f')]();};}function respondWithResult(_0x10dd4a,_0x363c9c){_0x363c9c=_0x363c9c||0xc8;return function(_0x2663b8){if(_0x2663b8){return _0x10dd4a['status'](_0x363c9c)['json'](_0x2663b8);}};}function respondWithFilteredResult(_0x10c42e,_0x576479){return function(_0x716800){if(_0x716800){var _0x1f8e4a=_0x716800[_0x821a('0x20')],_0x445ab5=_0x576479['offset'],_0x1da377=_0x576479[_0x821a('0x21')]+_0x576479[_0x821a('0x22')],_0x1177e6;if(_0x1da377>=_0x1f8e4a){_0x1da377=_0x1f8e4a;_0x1177e6=0xc8;}else{_0x1177e6=0xce;}_0x10c42e[_0x821a('0x23')](_0x1177e6);return _0x10c42e['set'](_0x821a('0x24'),_0x445ab5+'-'+_0x1da377+'/'+_0x1f8e4a)[_0x821a('0x25')](_0x716800);}return null;};}function patchUpdates(_0x24b47c){return function(_0x407d95){try{jsonpatch[_0x821a('0x26')](_0x407d95,_0x24b47c,!![]);}catch(_0x111bab){return BPromise[_0x821a('0x27')](_0x111bab);}return _0x407d95['save']();};}function saveUpdates(_0x4d402e,_0x3764d1){return function(_0x1f9515){if(_0x1f9515){return _0x1f9515[_0x821a('0x28')](_0x4d402e)[_0x821a('0x29')](function(_0x17736b){return _0x17736b;});}return null;};}function removeEntity(_0x41cd15,_0x5f2de0){return function(_0x264086){if(_0x264086){return _0x264086['destroy']()[_0x821a('0x29')](function(){_0x41cd15['status'](0xcc)[_0x821a('0x1f')]();});}};}function handleEntityNotFound(_0x2ebae9,_0x1c98ab){return function(_0x42e895){if(!_0x42e895){_0x2ebae9[_0x821a('0x1e')](0x194);}return _0x42e895;};}function handleError(_0x5b2eae,_0x46fb95){_0x46fb95=_0x46fb95||0x1f4;return function(_0x4dab90){logger[_0x821a('0x2a')](_0x4dab90[_0x821a('0x2b')]);if(_0x4dab90[_0x821a('0x2c')]){delete _0x4dab90[_0x821a('0x2c')];}_0x5b2eae[_0x821a('0x23')](_0x46fb95)[_0x821a('0x2d')](_0x4dab90);};}exports[_0x821a('0x2e')]=function(_0x627e1a,_0x1bca1a){var _0x4ed4c8={},_0x242fe8={},_0x4791f6={'count':0x0,'rows':[]};var _0x4eb833=_[_0x821a('0x2f')](db[_0x821a('0x30')][_0x821a('0x31')],function(_0x10cfb0){return{'name':_0x10cfb0[_0x821a('0x32')],'type':_0x10cfb0['type'][_0x821a('0x33')]};});_0x242fe8[_0x821a('0x34')]=_['map'](_0x4eb833,_0x821a('0x2c'));_0x242fe8[_0x821a('0x35')]=_[_0x821a('0x36')](_0x627e1a[_0x821a('0x35')]);_0x242fe8[_0x821a('0x37')]=_[_0x821a('0x38')](_0x242fe8[_0x821a('0x34')],_0x242fe8['query']);_0x4ed4c8['attributes']=_[_0x821a('0x38')](_0x242fe8[_0x821a('0x34')],qs[_0x821a('0x39')](_0x627e1a['query'][_0x821a('0x39')]));_0x4ed4c8['attributes']=_0x4ed4c8[_0x821a('0x3a')]['length']?_0x4ed4c8['attributes']:_0x242fe8[_0x821a('0x34')];if(!_0x627e1a[_0x821a('0x35')][_0x821a('0x3b')]('nolimit')){_0x4ed4c8[_0x821a('0x22')]=qs[_0x821a('0x22')](_0x627e1a['query'][_0x821a('0x22')]);_0x4ed4c8[_0x821a('0x21')]=qs[_0x821a('0x21')](_0x627e1a[_0x821a('0x35')][_0x821a('0x21')]);}_0x4ed4c8[_0x821a('0x3c')]=qs[_0x821a('0x3d')](_0x627e1a[_0x821a('0x35')]['sort']);_0x4ed4c8[_0x821a('0x3e')]=qs[_0x821a('0x37')](_[_0x821a('0x3f')](_0x627e1a['query'],_0x242fe8['filters']),_0x4eb833);if(_0x627e1a[_0x821a('0x35')][_0x821a('0x40')]){_0x4ed4c8[_0x821a('0x3e')]=_[_0x821a('0x41')](_0x4ed4c8[_0x821a('0x3e')],{'$or':_[_0x821a('0x2f')](_0x4eb833,function(_0x3c4115){if(_0x3c4115['type']!==_0x821a('0x42')){var _0x3ddea0={};_0x3ddea0[_0x3c4115[_0x821a('0x2c')]]={'$like':'%'+_0x627e1a[_0x821a('0x35')][_0x821a('0x40')]+'%'};return _0x3ddea0;}})});}_0x4ed4c8=_[_0x821a('0x41')]({},_0x4ed4c8,_0x627e1a[_0x821a('0x43')]);var _0x495b6c={'where':_0x4ed4c8[_0x821a('0x3e')]};return db[_0x821a('0x30')][_0x821a('0x20')](_0x495b6c)[_0x821a('0x29')](function(_0x3be211){_0x4791f6['count']=_0x3be211;if(_0x627e1a[_0x821a('0x35')][_0x821a('0x44')]){_0x4ed4c8[_0x821a('0x45')]=[{'all':!![]}];}return db[_0x821a('0x30')][_0x821a('0x46')](_0x4ed4c8);})[_0x821a('0x29')](function(_0x1d917d){_0x4791f6[_0x821a('0x47')]=_0x1d917d;return _0x4791f6;})[_0x821a('0x29')](respondWithFilteredResult(_0x1bca1a,_0x4ed4c8))[_0x821a('0x48')](handleError(_0x1bca1a,null));};exports['show']=function(_0x2c323e,_0x4f130f){var _0x812676={'raw':!![],'where':{'id':_0x2c323e[_0x821a('0x49')]['id']}},_0x169121={};_0x169121[_0x821a('0x34')]=_[_0x821a('0x36')](db[_0x821a('0x30')][_0x821a('0x31')]);_0x169121['query']=_['keys'](_0x2c323e[_0x821a('0x35')]);_0x169121[_0x821a('0x37')]=_[_0x821a('0x38')](_0x169121['model'],_0x169121[_0x821a('0x35')]);_0x812676[_0x821a('0x3a')]=_[_0x821a('0x38')](_0x169121[_0x821a('0x34')],qs[_0x821a('0x39')](_0x2c323e['query'][_0x821a('0x39')]));_0x812676['attributes']=_0x812676['attributes'][_0x821a('0x4a')]?_0x812676[_0x821a('0x3a')]:_0x169121['model'];if(_0x2c323e[_0x821a('0x35')][_0x821a('0x44')]){_0x812676['include']=[{'all':!![]}];}_0x812676=_[_0x821a('0x41')]({},_0x812676,_0x2c323e['options']);return db['SquareDetailsReport'][_0x821a('0x4b')](_0x812676)[_0x821a('0x29')](handleEntityNotFound(_0x4f130f,null))['then'](respondWithResult(_0x4f130f,null))[_0x821a('0x48')](handleError(_0x4f130f,null));};exports[_0x821a('0x4c')]=function(_0x286153,_0x9dd9){return db['SquareDetailsReport'][_0x821a('0x4c')](_0x286153[_0x821a('0x4d')],{})['then'](respondWithResult(_0x9dd9,0xc9))['catch'](handleError(_0x9dd9,null));};exports[_0x821a('0x28')]=function(_0x3eafae,_0x290363){if(_0x3eafae[_0x821a('0x4d')]['id']){delete _0x3eafae[_0x821a('0x4d')]['id'];}return db['SquareDetailsReport'][_0x821a('0x4b')]({'where':{'id':_0x3eafae[_0x821a('0x49')]['id']}})['then'](handleEntityNotFound(_0x290363,null))[_0x821a('0x29')](saveUpdates(_0x3eafae[_0x821a('0x4d')],null))[_0x821a('0x29')](respondWithResult(_0x290363,null))['catch'](handleError(_0x290363,null));};exports[_0x821a('0x4e')]=function(_0x5889e6,_0x26d09e){return db['SquareDetailsReport'][_0x821a('0x4b')]({'where':{'id':_0x5889e6['params']['id']}})['then'](handleEntityNotFound(_0x26d09e,null))[_0x821a('0x29')](removeEntity(_0x26d09e,null))[_0x821a('0x48')](handleError(_0x26d09e,null));};exports[_0x821a('0x4f')]=function(_0x326e08,_0x29b0f5){return db[_0x821a('0x30')]['describe']()[_0x821a('0x29')](respondWithResult(_0x29b0f5,null))['catch'](handleError(_0x29b0f5,null));};
\ No newline at end of file