Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / api / squareReportDetail / squareReportDetail.controller.js
index 66798a9..8d53fc6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e07=['zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','reject','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','update','body','describe','html-pdf','eml-format','rimraf'];(function(_0x27c745,_0xbb3c86){var _0x3c6ad0=function(_0x319230){while(--_0x319230){_0x27c745['push'](_0x27c745['shift']());}};_0x3c6ad0(++_0xbb3c86);}(_0x5e07,0xd8));var _0x75e0=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x5e07[_0x484e36];return _0xafc85d;};'use strict';var pdf=require(_0x75e0('0x0'));var emlformat=require(_0x75e0('0x1'));var rimraf=require(_0x75e0('0x2'));var zipdir=require(_0x75e0('0x3'));var jsonpatch=require(_0x75e0('0x4'));var rp=require('request-promise');var moment=require(_0x75e0('0x5'));var BPromise=require(_0x75e0('0x6'));var Mustache=require(_0x75e0('0x7'));var util=require('util');var path=require('path');var sox=require(_0x75e0('0x8'));var csv=require(_0x75e0('0x9'));var ejs=require(_0x75e0('0xa'));var fs=require('fs');var _=require(_0x75e0('0xb'));var squel=require(_0x75e0('0xc'));var crypto=require(_0x75e0('0xd'));var jsforce=require(_0x75e0('0xe'));var deskjs=require(_0x75e0('0xf'));var toCsv=require(_0x75e0('0x9'));var querystring=require(_0x75e0('0x10'));var Papa=require(_0x75e0('0x11'));var Redis=require(_0x75e0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75e0('0x13'));var hardwareService=require(_0x75e0('0x14'));var logger=require(_0x75e0('0x15'))(_0x75e0('0x16'));var utils=require('../../config/utils');var config=require(_0x75e0('0x17'));var db=require(_0x75e0('0x18'))['db'];function respondWithStatusCode(_0x16e0e2,_0x4f3b0b){_0x4f3b0b=_0x4f3b0b||0xcc;return function(_0xe9fec3){if(_0xe9fec3){return _0x16e0e2[_0x75e0('0x19')](_0x4f3b0b);}return _0x16e0e2[_0x75e0('0x1a')](_0x4f3b0b)[_0x75e0('0x1b')]();};}function respondWithResult(_0x72330c,_0x44092c){_0x44092c=_0x44092c||0xc8;return function(_0x2540b8){if(_0x2540b8){return _0x72330c[_0x75e0('0x1a')](_0x44092c)['json'](_0x2540b8);}};}function respondWithFilteredResult(_0x4fe948,_0x1077ad){return function(_0x4255f8){if(_0x4255f8){var _0x2d3bde=_0x4255f8['count'],_0x5731f3=_0x1077ad[_0x75e0('0x1c')],_0x22e27e=_0x1077ad[_0x75e0('0x1c')]+_0x1077ad[_0x75e0('0x1d')],_0x35d6a6;if(_0x22e27e>=_0x2d3bde){_0x22e27e=_0x2d3bde;_0x35d6a6=0xc8;}else{_0x35d6a6=0xce;}_0x4fe948[_0x75e0('0x1a')](_0x35d6a6);return _0x4fe948[_0x75e0('0x1e')](_0x75e0('0x1f'),_0x5731f3+'-'+_0x22e27e+'/'+_0x2d3bde)['json'](_0x4255f8);}return null;};}function patchUpdates(_0x4cca09){return function(_0x1c4b84){try{jsonpatch['apply'](_0x1c4b84,_0x4cca09,!![]);}catch(_0xe8d106){return BPromise[_0x75e0('0x20')](_0xe8d106);}return _0x1c4b84['save']();};}function saveUpdates(_0x32b08e,_0x40fd49){return function(_0x245cec){if(_0x245cec){return _0x245cec['update'](_0x32b08e)[_0x75e0('0x21')](function(_0x31be8a){return _0x31be8a;});}return null;};}function removeEntity(_0x39abf0,_0x11ae84){return function(_0x1f4e89){if(_0x1f4e89){return _0x1f4e89[_0x75e0('0x22')]()[_0x75e0('0x21')](function(){_0x39abf0[_0x75e0('0x1a')](0xcc)[_0x75e0('0x1b')]();});}};}function handleEntityNotFound(_0x350cf8,_0x3f813b){return function(_0x518211){if(!_0x518211){_0x350cf8['sendStatus'](0x194);}return _0x518211;};}function handleError(_0x5e2753,_0x56817a){_0x56817a=_0x56817a||0x1f4;return function(_0x14bd18){logger[_0x75e0('0x23')](_0x14bd18[_0x75e0('0x24')]);if(_0x14bd18['name']){delete _0x14bd18[_0x75e0('0x25')];}_0x5e2753[_0x75e0('0x1a')](_0x56817a)[_0x75e0('0x26')](_0x14bd18);};}exports[_0x75e0('0x27')]=function(_0x2818eb,_0x5681a2){var _0x36ffa5={},_0x42f2e1={},_0x13b4ef={'count':0x0,'rows':[]};var _0x3894b9=_[_0x75e0('0x28')](db[_0x75e0('0x29')]['rawAttributes'],function(_0x1da421){return{'name':_0x1da421['fieldName'],'type':_0x1da421[_0x75e0('0x2a')][_0x75e0('0x2b')]};});_0x42f2e1[_0x75e0('0x2c')]=_[_0x75e0('0x28')](_0x3894b9,_0x75e0('0x25'));_0x42f2e1[_0x75e0('0x2d')]=_['keys'](_0x2818eb[_0x75e0('0x2d')]);_0x42f2e1[_0x75e0('0x2e')]=_['intersection'](_0x42f2e1[_0x75e0('0x2c')],_0x42f2e1[_0x75e0('0x2d')]);_0x36ffa5[_0x75e0('0x2f')]=_[_0x75e0('0x30')](_0x42f2e1['model'],qs[_0x75e0('0x31')](_0x2818eb[_0x75e0('0x2d')][_0x75e0('0x31')]));_0x36ffa5[_0x75e0('0x2f')]=_0x36ffa5[_0x75e0('0x2f')]['length']?_0x36ffa5['attributes']:_0x42f2e1[_0x75e0('0x2c')];if(!_0x2818eb[_0x75e0('0x2d')][_0x75e0('0x32')](_0x75e0('0x33'))){_0x36ffa5[_0x75e0('0x1d')]=qs[_0x75e0('0x1d')](_0x2818eb[_0x75e0('0x2d')]['limit']);_0x36ffa5[_0x75e0('0x1c')]=qs[_0x75e0('0x1c')](_0x2818eb[_0x75e0('0x2d')][_0x75e0('0x1c')]);}_0x36ffa5[_0x75e0('0x34')]=qs[_0x75e0('0x35')](_0x2818eb[_0x75e0('0x2d')][_0x75e0('0x35')]);_0x36ffa5[_0x75e0('0x36')]=qs[_0x75e0('0x2e')](_['pick'](_0x2818eb[_0x75e0('0x2d')],_0x42f2e1[_0x75e0('0x2e')]));if(_0x2818eb[_0x75e0('0x2d')][_0x75e0('0x37')]){_0x36ffa5[_0x75e0('0x36')]=_[_0x75e0('0x38')](_0x36ffa5[_0x75e0('0x36')],{'$or':_[_0x75e0('0x28')](_0x3894b9,function(_0x317700){if(_0x317700['type']!==_0x75e0('0x39')){var _0x25cf16={};_0x25cf16[_0x317700[_0x75e0('0x25')]]={'$like':'%'+_0x2818eb[_0x75e0('0x2d')]['filter']+'%'};return _0x25cf16;}})});}_0x36ffa5=_[_0x75e0('0x38')]({},_0x36ffa5,_0x2818eb['options']);var _0x535a68={'where':_0x36ffa5[_0x75e0('0x36')]};return db[_0x75e0('0x29')][_0x75e0('0x3a')](_0x535a68)[_0x75e0('0x21')](function(_0x73d8c0){_0x13b4ef[_0x75e0('0x3a')]=_0x73d8c0;if(_0x2818eb[_0x75e0('0x2d')][_0x75e0('0x3b')]){_0x36ffa5['include']=[{'all':!![]}];}return db[_0x75e0('0x29')][_0x75e0('0x3c')](_0x36ffa5);})[_0x75e0('0x21')](function(_0x22cc00){_0x13b4ef[_0x75e0('0x3d')]=_0x22cc00;return _0x13b4ef;})[_0x75e0('0x21')](respondWithFilteredResult(_0x5681a2,_0x36ffa5))[_0x75e0('0x3e')](handleError(_0x5681a2,null));};exports[_0x75e0('0x3f')]=function(_0x5bb890,_0x254669){var _0x484e04={'raw':!![],'where':{'id':_0x5bb890[_0x75e0('0x40')]['id']}},_0x200c0c={};_0x200c0c['model']=_[_0x75e0('0x41')](db[_0x75e0('0x29')][_0x75e0('0x42')]);_0x200c0c['query']=_[_0x75e0('0x41')](_0x5bb890[_0x75e0('0x2d')]);_0x200c0c[_0x75e0('0x2e')]=_[_0x75e0('0x30')](_0x200c0c[_0x75e0('0x2c')],_0x200c0c[_0x75e0('0x2d')]);_0x484e04[_0x75e0('0x2f')]=_['intersection'](_0x200c0c[_0x75e0('0x2c')],qs[_0x75e0('0x31')](_0x5bb890['query'][_0x75e0('0x31')]));_0x484e04[_0x75e0('0x2f')]=_0x484e04['attributes']['length']?_0x484e04[_0x75e0('0x2f')]:_0x200c0c['model'];if(_0x5bb890[_0x75e0('0x2d')][_0x75e0('0x3b')]){_0x484e04[_0x75e0('0x43')]=[{'all':!![]}];}_0x484e04=_['merge']({},_0x484e04,_0x5bb890['options']);return db['SquareDetailsReport'][_0x75e0('0x44')](_0x484e04)['then'](handleEntityNotFound(_0x254669,null))[_0x75e0('0x21')](respondWithResult(_0x254669,null))[_0x75e0('0x3e')](handleError(_0x254669,null));};exports[_0x75e0('0x45')]=function(_0x2ff505,_0x355676){return db[_0x75e0('0x29')][_0x75e0('0x45')](_0x2ff505['body'],{})['then'](respondWithResult(_0x355676,0xc9))[_0x75e0('0x3e')](handleError(_0x355676,null));};exports[_0x75e0('0x46')]=function(_0x33de8b,_0x171b2c){if(_0x33de8b[_0x75e0('0x47')]['id']){delete _0x33de8b['body']['id'];}return db[_0x75e0('0x29')][_0x75e0('0x44')]({'where':{'id':_0x33de8b['params']['id']}})['then'](handleEntityNotFound(_0x171b2c,null))[_0x75e0('0x21')](saveUpdates(_0x33de8b[_0x75e0('0x47')],null))[_0x75e0('0x21')](respondWithResult(_0x171b2c,null))[_0x75e0('0x3e')](handleError(_0x171b2c,null));};exports[_0x75e0('0x22')]=function(_0x1a1dc0,_0x45c476){return db['SquareDetailsReport']['find']({'where':{'id':_0x1a1dc0[_0x75e0('0x40')]['id']}})[_0x75e0('0x21')](handleEntityNotFound(_0x45c476,null))['then'](removeEntity(_0x45c476,null))[_0x75e0('0x3e')](handleError(_0x45c476,null));};exports[_0x75e0('0x48')]=function(_0x24cf8b,_0x17021d){return db[_0x75e0('0x29')]['describe']()['then'](respondWithResult(_0x17021d,null))[_0x75e0('0x3e')](handleError(_0x17021d,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