Built motion from commit (unavailable).|2.0.84
[motion2.git] / server / api / squareRecording / squareRecording.controller.js
index 5a4e75c..d971e27 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3b31=['length','find','create','body','download','type','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','send','index','SquareRecording','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','includeAll','include','rows','catch','params'];(function(_0x10d5e5,_0x1715ad){var _0x3e5845=function(_0x75541c){while(--_0x75541c){_0x10d5e5['push'](_0x10d5e5['shift']());}};_0x3e5845(++_0x1715ad);}(_0x3b31,0x64));var _0x13b3=function(_0x1af089,_0x55f6c9){_0x1af089=_0x1af089-0x0;var _0x33eb3e=_0x3b31[_0x1af089];return _0x33eb3e;};'use strict';var pdf=require(_0x13b3('0x0'));var emlformat=require(_0x13b3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x13b3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x13b3('0x3'));var Mustache=require(_0x13b3('0x4'));var util=require(_0x13b3('0x5'));var path=require('path');var sox=require(_0x13b3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x13b3('0x7'));var squel=require(_0x13b3('0x8'));var crypto=require(_0x13b3('0x9'));var jsforce=require(_0x13b3('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x13b3('0xb'));var querystring=require(_0x13b3('0xc'));var Papa=require(_0x13b3('0xd'));var qs=require(_0x13b3('0xe'));var logger=require(_0x13b3('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x13b3('0x10'));var db=require(_0x13b3('0x11'))['db'];function respondWithStatusCode(_0x462364,_0x36652f){_0x36652f=_0x36652f||0xcc;return function(_0x45aab0){if(_0x45aab0){return _0x462364[_0x13b3('0x12')](_0x36652f);}return _0x462364[_0x13b3('0x13')](_0x36652f)['end']();};}function respondWithResult(_0x2a4522,_0x147da0){_0x147da0=_0x147da0||0xc8;return function(_0x1df49f){if(_0x1df49f){return _0x2a4522[_0x13b3('0x13')](_0x147da0)[_0x13b3('0x14')](_0x1df49f);}};}function respondWithFilteredResult(_0x5b78e7,_0x35952d){return function(_0x46aa9d){if(_0x46aa9d){var _0x4b4bbb=_0x46aa9d[_0x13b3('0x15')],_0x3abfbb=_0x35952d[_0x13b3('0x16')],_0x2d40c2=_0x35952d[_0x13b3('0x16')]+_0x35952d[_0x13b3('0x17')],_0x2326ed;if(_0x2d40c2>=_0x4b4bbb){_0x2d40c2=_0x4b4bbb;_0x2326ed=0xc8;}else{_0x2326ed=0xce;}_0x5b78e7[_0x13b3('0x13')](_0x2326ed);return _0x5b78e7[_0x13b3('0x18')](_0x13b3('0x19'),_0x3abfbb+'-'+_0x2d40c2+'/'+_0x4b4bbb)[_0x13b3('0x14')](_0x46aa9d);}return null;};}function patchUpdates(_0x29ab30){return function(_0x45d0e9){try{jsonpatch['apply'](_0x45d0e9,_0x29ab30,!![]);}catch(_0x461d3b){return BPromise[_0x13b3('0x1a')](_0x461d3b);}return _0x45d0e9[_0x13b3('0x1b')]();};}function saveUpdates(_0x26fb07,_0x10b0fd){return function(_0x57a9d5){if(_0x57a9d5){return _0x57a9d5[_0x13b3('0x1c')](_0x26fb07)[_0x13b3('0x1d')](function(_0x1d4b88){return _0x1d4b88;});}return null;};}function removeEntity(_0x452fc0,_0x51d83c){return function(_0x442a32){if(_0x442a32){return _0x442a32[_0x13b3('0x1e')]()[_0x13b3('0x1d')](function(){_0x452fc0[_0x13b3('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3baa08,_0x272768){return function(_0x58153a){if(!_0x58153a){_0x3baa08[_0x13b3('0x12')](0x194);}return _0x58153a;};}function handleError(_0x396741,_0x4504f9){_0x4504f9=_0x4504f9||0x1f4;return function(_0x3ba2fe){logger['error'](_0x3ba2fe['stack']);if(_0x3ba2fe['name']){delete _0x3ba2fe['name'];}_0x396741[_0x13b3('0x13')](_0x4504f9)[_0x13b3('0x1f')](_0x3ba2fe);};}exports[_0x13b3('0x20')]=function(_0x28fdaf,_0x380747){var _0xa8f30f={},_0x253fea={},_0x592740={'count':0x0,'rows':[]};var _0x5e8d82=db[_0x13b3('0x21')][_0x13b3('0x22')];_0x253fea[_0x13b3('0x23')]=_[_0x13b3('0x24')](_0x5e8d82);var _0x25a269={'dateStart':_0x28fdaf['query'][_0x13b3('0x25')],'dateEnd':_0x28fdaf[_0x13b3('0x26')]['dateEnd']};delete _0x28fdaf[_0x13b3('0x26')][_0x13b3('0x25')];delete _0x28fdaf[_0x13b3('0x26')][_0x13b3('0x27')];_0x253fea['query']=_[_0x13b3('0x24')](_0x28fdaf[_0x13b3('0x26')]);_0x253fea['filters']=_[_0x13b3('0x28')](_0x253fea[_0x13b3('0x23')],_0x253fea[_0x13b3('0x26')]);_0xa8f30f[_0x13b3('0x29')]=_[_0x13b3('0x28')](_0x253fea['model'],qs[_0x13b3('0x2a')](_0x28fdaf[_0x13b3('0x26')][_0x13b3('0x2a')]));_0xa8f30f[_0x13b3('0x29')]=_0xa8f30f[_0x13b3('0x29')]['length']?_0xa8f30f['attributes']:_0x253fea['model'];if(!_0x28fdaf[_0x13b3('0x26')][_0x13b3('0x2b')](_0x13b3('0x2c'))){_0xa8f30f[_0x13b3('0x17')]=qs['limit'](_0x28fdaf['query'][_0x13b3('0x17')]);_0xa8f30f[_0x13b3('0x16')]=qs['offset'](_0x28fdaf[_0x13b3('0x26')][_0x13b3('0x16')]);}_0xa8f30f[_0x13b3('0x2d')]=qs[_0x13b3('0x2e')](_0x28fdaf[_0x13b3('0x26')][_0x13b3('0x2e')]);_0xa8f30f[_0x13b3('0x2f')]=qs[_0x13b3('0x30')](_[_0x13b3('0x31')](_0x28fdaf['query'],_0x253fea['filters']));if(_0x25a269[_0x13b3('0x25')]){if(_0x25a269[_0x13b3('0x27')]){_0x25a269[_0x13b3('0x27')]=moment(_0x25a269['dateEnd'])[_0x13b3('0x32')](0x1,'day');}else{_0x25a269['dateEnd']=moment(_0x25a269[_0x13b3('0x25')])[_0x13b3('0x32')](0x1,_0x13b3('0x33'));}_[_0x13b3('0x34')](_0xa8f30f[_0x13b3('0x2f')],{'createdAt':{'$gte':_0x25a269[_0x13b3('0x25')],'$lte':_0x25a269['dateEnd']}});}if(_0x28fdaf['query'][_0x13b3('0x35')]){_0xa8f30f[_0x13b3('0x2f')]=_['merge'](_0xa8f30f[_0x13b3('0x2f')],{'$or':_[_0x13b3('0x36')](_0xa8f30f['attributes'],function(_0x8fe834){var _0x38b063={};_0x38b063[_0x8fe834]={'$like':'%'+_0x28fdaf[_0x13b3('0x26')][_0x13b3('0x35')]+'%'};return _0x38b063;})});}_0xa8f30f=_[_0x13b3('0x34')]({},_0xa8f30f,_0x28fdaf['options']);var _0x3a773b={'where':_0xa8f30f[_0x13b3('0x2f')]};return db[_0x13b3('0x21')][_0x13b3('0x15')](_0x3a773b)[_0x13b3('0x1d')](function(_0x58eade){_0x592740[_0x13b3('0x15')]=_0x58eade;if(_0x28fdaf[_0x13b3('0x26')][_0x13b3('0x37')]){_0xa8f30f[_0x13b3('0x38')]=[{'all':!![]}];}return db[_0x13b3('0x21')]['findAll'](_0xa8f30f);})['then'](function(_0xf6a2fb){_0x592740[_0x13b3('0x39')]=_0xf6a2fb;return _0x592740;})['then'](respondWithFilteredResult(_0x380747,_0xa8f30f))[_0x13b3('0x3a')](handleError(_0x380747,null));};exports['show']=function(_0x10d984,_0x102f00){var _0x1c2c48={'raw':!![],'where':{'id':_0x10d984[_0x13b3('0x3b')]['id']}},_0x9ba4e8={};_0x9ba4e8[_0x13b3('0x23')]=_[_0x13b3('0x24')](db[_0x13b3('0x21')][_0x13b3('0x22')]);_0x9ba4e8[_0x13b3('0x26')]=_['keys'](_0x10d984[_0x13b3('0x26')]);_0x9ba4e8[_0x13b3('0x30')]=_[_0x13b3('0x28')](_0x9ba4e8[_0x13b3('0x23')],_0x9ba4e8['query']);_0x1c2c48[_0x13b3('0x29')]=_['intersection'](_0x9ba4e8[_0x13b3('0x23')],qs[_0x13b3('0x2a')](_0x10d984[_0x13b3('0x26')][_0x13b3('0x2a')]));_0x1c2c48['attributes']=_0x1c2c48[_0x13b3('0x29')][_0x13b3('0x3c')]?_0x1c2c48['attributes']:_0x9ba4e8[_0x13b3('0x23')];if(_0x10d984[_0x13b3('0x26')][_0x13b3('0x37')]){_0x1c2c48[_0x13b3('0x38')]=[{'all':!![]}];}_0x1c2c48=_[_0x13b3('0x34')]({},_0x1c2c48,_0x10d984['options']);return db[_0x13b3('0x21')][_0x13b3('0x3d')](_0x1c2c48)[_0x13b3('0x1d')](handleEntityNotFound(_0x102f00,null))[_0x13b3('0x1d')](respondWithResult(_0x102f00,null))[_0x13b3('0x3a')](handleError(_0x102f00,null));};exports[_0x13b3('0x3e')]=function(_0x4caeaf,_0x3abce4){return db[_0x13b3('0x21')]['create'](_0x4caeaf[_0x13b3('0x3f')],{})[_0x13b3('0x1d')](respondWithResult(_0x3abce4,0xc9))[_0x13b3('0x3a')](handleError(_0x3abce4,null));};exports[_0x13b3('0x1c')]=function(_0x1799de,_0x4c3680){if(_0x1799de[_0x13b3('0x3f')]['id']){delete _0x1799de[_0x13b3('0x3f')]['id'];}return db['SquareRecording'][_0x13b3('0x3d')]({'where':{'id':_0x1799de[_0x13b3('0x3b')]['id']}})[_0x13b3('0x1d')](handleEntityNotFound(_0x4c3680,null))[_0x13b3('0x1d')](saveUpdates(_0x1799de[_0x13b3('0x3f')],null))['then'](respondWithResult(_0x4c3680,null))[_0x13b3('0x3a')](handleError(_0x4c3680,null));};exports[_0x13b3('0x1e')]=function(_0x11b4bf,_0x54b46f){return db[_0x13b3('0x21')][_0x13b3('0x3d')]({'where':{'id':_0x11b4bf['params']['id']}})[_0x13b3('0x1d')](handleEntityNotFound(_0x54b46f,null))[_0x13b3('0x1d')](removeEntity(_0x54b46f,null))[_0x13b3('0x3a')](handleError(_0x54b46f,null));};exports[_0x13b3('0x40')]=function(_0x1feec,_0x417157,_0x51597f){var _0x6275e2=require('../../components/encryptor');var _0x3e7abd=![];var _0x2b9066={};if(_0x1feec[_0x13b3('0x26')][_0x13b3('0x41')]&&_0x1feec[_0x13b3('0x26')][_0x13b3('0x41')]===_0x13b3('0x42')){_0x2b9066['uniqueid']=_0x1feec[_0x13b3('0x3b')]['id'];}else{_0x2b9066['id']=_0x1feec[_0x13b3('0x3b')]['id'];}return db[_0x13b3('0x21')][_0x13b3('0x3d')]({'where':_0x2b9066,'attributes':['id',_0x13b3('0x43'),_0x13b3('0x44')],'raw':!![]})[_0x13b3('0x1d')](handleEntityNotFound(_0x417157,null))[_0x13b3('0x1d')](function(_0x522229){if(_0x522229){var _0x1ff2b0=util[_0x13b3('0x45')](_0x13b3('0x46'),_0x522229['value']);if(fs[_0x13b3('0x47')](_0x1ff2b0)){_0x3e7abd=!![];return _0x6275e2[_0x13b3('0x48')](_0x1ff2b0,_0x522229[_0x13b3('0x43')],config[_0x13b3('0x49')][_0x13b3('0x4a')])[_0x13b3('0x1d')](function(){return _0x522229;});}return _0x522229;}})[_0x13b3('0x1d')](function(_0x3d1597){if(_0x3d1597){if(!fs[_0x13b3('0x47')](_0x3d1597[_0x13b3('0x43')])){throw new db[(_0x13b3('0x4b'))][(_0x13b3('0x4c'))](_0x13b3('0x4d'));}if(_0x3d1597[_0x13b3('0x44')]){return _0x417157[_0x13b3('0x40')](_0x3d1597['savePath'],_0x3d1597[_0x13b3('0x44')]+path[_0x13b3('0x4e')](_0x3d1597[_0x13b3('0x43')]),function(){if(_0x3e7abd){fs[_0x13b3('0x4f')](_0x3d1597['savePath']);}});}else{return _0x417157['download'](_0x3d1597['savePath'],function(_0x52479a){if(_0x3e7abd){fs['unlink'](_0x3d1597['savePath']);}});}}})[_0x13b3('0x3a')](handleError(_0x417157,null));};
\ No newline at end of file
+var _0x5f31=['querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','add','day','merge','filter','options','SquareRecording','include','findAll','rows','params','includeAll','find','catch','create','body','download','../../components/encryptor','type','uniqueid','savePath','filename','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x252d9d,_0x4e3e15){var _0x2b721f=function(_0x1d9f4d){while(--_0x1d9f4d){_0x252d9d['push'](_0x252d9d['shift']());}};_0x2b721f(++_0x4e3e15);}(_0x5f31,0x19f));var _0x15f3=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x5f31[_0x55ff79];return _0x579067;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x15f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15f3('0x1'));var jsonpatch=require(_0x15f3('0x2'));var rp=require('request-promise');var moment=require(_0x15f3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x15f3('0x4'));var util=require(_0x15f3('0x5'));var path=require(_0x15f3('0x6'));var sox=require(_0x15f3('0x7'));var csv=require(_0x15f3('0x8'));var ejs=require(_0x15f3('0x9'));var fs=require('fs');var _=require(_0x15f3('0xa'));var squel=require(_0x15f3('0xb'));var crypto=require(_0x15f3('0xc'));var jsforce=require(_0x15f3('0xd'));var deskjs=require(_0x15f3('0xe'));var toCsv=require(_0x15f3('0x8'));var querystring=require(_0x15f3('0xf'));var Papa=require('papaparse');var Redis=require(_0x15f3('0x10'));var qs=require(_0x15f3('0x11'));var logger=require(_0x15f3('0x12'))(_0x15f3('0x13'));var utils=require('../../config/utils');var config=require(_0x15f3('0x14'));var db=require(_0x15f3('0x15'))['db'];function respondWithStatusCode(_0x5bc778,_0x48a850){_0x48a850=_0x48a850||0xcc;return function(_0x45a011){if(_0x45a011){return _0x5bc778[_0x15f3('0x16')](_0x48a850);}return _0x5bc778[_0x15f3('0x17')](_0x48a850)[_0x15f3('0x18')]();};}function respondWithResult(_0x2208be,_0x37cb0b){_0x37cb0b=_0x37cb0b||0xc8;return function(_0x5bd68c){if(_0x5bd68c){return _0x2208be['status'](_0x37cb0b)[_0x15f3('0x19')](_0x5bd68c);}};}function respondWithFilteredResult(_0x2a2c3e,_0x201487){return function(_0x28c967){if(_0x28c967){var _0x3b34dc=_0x28c967[_0x15f3('0x1a')],_0x36bc33=_0x201487[_0x15f3('0x1b')],_0x385f7c=_0x201487[_0x15f3('0x1b')]+_0x201487[_0x15f3('0x1c')],_0x48c360;if(_0x385f7c>=_0x3b34dc){_0x385f7c=_0x3b34dc;_0x48c360=0xc8;}else{_0x48c360=0xce;}_0x2a2c3e[_0x15f3('0x17')](_0x48c360);return _0x2a2c3e[_0x15f3('0x1d')](_0x15f3('0x1e'),_0x36bc33+'-'+_0x385f7c+'/'+_0x3b34dc)[_0x15f3('0x19')](_0x28c967);}return null;};}function patchUpdates(_0x1f3b40){return function(_0x5517a9){try{jsonpatch[_0x15f3('0x1f')](_0x5517a9,_0x1f3b40,!![]);}catch(_0x124af7){return BPromise['reject'](_0x124af7);}return _0x5517a9[_0x15f3('0x20')]();};}function saveUpdates(_0x5800e5,_0x493984){return function(_0x4f3b5f){if(_0x4f3b5f){return _0x4f3b5f[_0x15f3('0x21')](_0x5800e5)['then'](function(_0x2b5ba3){return _0x2b5ba3;});}return null;};}function removeEntity(_0x224f71,_0x3ff3b7){return function(_0x187c4f){if(_0x187c4f){return _0x187c4f[_0x15f3('0x22')]()[_0x15f3('0x23')](function(){_0x224f71[_0x15f3('0x17')](0xcc)[_0x15f3('0x18')]();});}};}function handleEntityNotFound(_0x5965b,_0x1532b7){return function(_0x16e03e){if(!_0x16e03e){_0x5965b[_0x15f3('0x16')](0x194);}return _0x16e03e;};}function handleError(_0x509b95,_0x5b8d24){_0x5b8d24=_0x5b8d24||0x1f4;return function(_0x4efede){logger[_0x15f3('0x24')](_0x4efede[_0x15f3('0x25')]);if(_0x4efede['name']){delete _0x4efede[_0x15f3('0x26')];}_0x509b95[_0x15f3('0x17')](_0x5b8d24)[_0x15f3('0x27')](_0x4efede);};}exports[_0x15f3('0x28')]=function(_0x1590a2,_0x32cdf8){var _0xf8bc99={},_0x4f52f0={},_0x328ef4={'count':0x0,'rows':[]};var _0x5af407=db['SquareRecording'][_0x15f3('0x29')];_0x4f52f0[_0x15f3('0x2a')]=_[_0x15f3('0x2b')](_0x5af407);var _0x17375e={'dateStart':_0x1590a2[_0x15f3('0x2c')][_0x15f3('0x2d')],'dateEnd':_0x1590a2[_0x15f3('0x2c')][_0x15f3('0x2e')]};delete _0x1590a2[_0x15f3('0x2c')][_0x15f3('0x2d')];delete _0x1590a2[_0x15f3('0x2c')][_0x15f3('0x2e')];_0x4f52f0[_0x15f3('0x2c')]=_[_0x15f3('0x2b')](_0x1590a2[_0x15f3('0x2c')]);_0x4f52f0[_0x15f3('0x2f')]=_['intersection'](_0x4f52f0[_0x15f3('0x2a')],_0x4f52f0['query']);_0xf8bc99['attributes']=_[_0x15f3('0x30')](_0x4f52f0['model'],qs['fields'](_0x1590a2[_0x15f3('0x2c')][_0x15f3('0x31')]));_0xf8bc99[_0x15f3('0x32')]=_0xf8bc99[_0x15f3('0x32')]['length']?_0xf8bc99[_0x15f3('0x32')]:_0x4f52f0[_0x15f3('0x2a')];if(!_0x1590a2[_0x15f3('0x2c')]['hasOwnProperty'](_0x15f3('0x33'))){_0xf8bc99['limit']=qs[_0x15f3('0x1c')](_0x1590a2[_0x15f3('0x2c')][_0x15f3('0x1c')]);_0xf8bc99['offset']=qs[_0x15f3('0x1b')](_0x1590a2[_0x15f3('0x2c')]['offset']);}_0xf8bc99[_0x15f3('0x34')]=qs[_0x15f3('0x35')](_0x1590a2['query'][_0x15f3('0x35')]);_0xf8bc99[_0x15f3('0x36')]=qs[_0x15f3('0x2f')](_[_0x15f3('0x37')](_0x1590a2[_0x15f3('0x2c')],_0x4f52f0[_0x15f3('0x2f')]));if(_0x17375e['dateStart']){if(_0x17375e['dateEnd']){_0x17375e[_0x15f3('0x2e')]=moment(_0x17375e['dateEnd'])[_0x15f3('0x38')](0x1,_0x15f3('0x39'));}else{_0x17375e[_0x15f3('0x2e')]=moment(_0x17375e[_0x15f3('0x2d')])[_0x15f3('0x38')](0x1,'day');}_['merge'](_0xf8bc99['where'],{'createdAt':{'$gte':_0x17375e[_0x15f3('0x2d')],'$lte':_0x17375e[_0x15f3('0x2e')]}});}if(_0x1590a2[_0x15f3('0x2c')]['filter']){_0xf8bc99[_0x15f3('0x36')]=_[_0x15f3('0x3a')](_0xf8bc99[_0x15f3('0x36')],{'$or':_['map'](_0xf8bc99['attributes'],function(_0x4c8bca){var _0x3aa226={};_0x3aa226[_0x4c8bca]={'$like':'%'+_0x1590a2[_0x15f3('0x2c')][_0x15f3('0x3b')]+'%'};return _0x3aa226;})});}_0xf8bc99=_[_0x15f3('0x3a')]({},_0xf8bc99,_0x1590a2[_0x15f3('0x3c')]);var _0x275792={'where':_0xf8bc99['where']};return db[_0x15f3('0x3d')]['count'](_0x275792)[_0x15f3('0x23')](function(_0x2dc41b){_0x328ef4[_0x15f3('0x1a')]=_0x2dc41b;if(_0x1590a2[_0x15f3('0x2c')]['includeAll']){_0xf8bc99[_0x15f3('0x3e')]=[{'all':!![]}];}return db[_0x15f3('0x3d')][_0x15f3('0x3f')](_0xf8bc99);})[_0x15f3('0x23')](function(_0x4f8caa){_0x328ef4[_0x15f3('0x40')]=_0x4f8caa;return _0x328ef4;})[_0x15f3('0x23')](respondWithFilteredResult(_0x32cdf8,_0xf8bc99))['catch'](handleError(_0x32cdf8,null));};exports['show']=function(_0x504cc8,_0x1ad728){var _0x3f9d78={'raw':!![],'where':{'id':_0x504cc8[_0x15f3('0x41')]['id']}},_0x392cce={};_0x392cce[_0x15f3('0x2a')]=_[_0x15f3('0x2b')](db[_0x15f3('0x3d')][_0x15f3('0x29')]);_0x392cce['query']=_['keys'](_0x504cc8[_0x15f3('0x2c')]);_0x392cce[_0x15f3('0x2f')]=_[_0x15f3('0x30')](_0x392cce[_0x15f3('0x2a')],_0x392cce[_0x15f3('0x2c')]);_0x3f9d78['attributes']=_[_0x15f3('0x30')](_0x392cce['model'],qs['fields'](_0x504cc8[_0x15f3('0x2c')][_0x15f3('0x31')]));_0x3f9d78[_0x15f3('0x32')]=_0x3f9d78[_0x15f3('0x32')]['length']?_0x3f9d78[_0x15f3('0x32')]:_0x392cce[_0x15f3('0x2a')];if(_0x504cc8[_0x15f3('0x2c')][_0x15f3('0x42')]){_0x3f9d78['include']=[{'all':!![]}];}_0x3f9d78=_[_0x15f3('0x3a')]({},_0x3f9d78,_0x504cc8[_0x15f3('0x3c')]);return db[_0x15f3('0x3d')][_0x15f3('0x43')](_0x3f9d78)['then'](handleEntityNotFound(_0x1ad728,null))[_0x15f3('0x23')](respondWithResult(_0x1ad728,null))[_0x15f3('0x44')](handleError(_0x1ad728,null));};exports['create']=function(_0x3a265b,_0x25e7d5){return db[_0x15f3('0x3d')][_0x15f3('0x45')](_0x3a265b[_0x15f3('0x46')],{})['then'](respondWithResult(_0x25e7d5,0xc9))[_0x15f3('0x44')](handleError(_0x25e7d5,null));};exports[_0x15f3('0x21')]=function(_0x3cad6b,_0x43038a){if(_0x3cad6b['body']['id']){delete _0x3cad6b[_0x15f3('0x46')]['id'];}return db[_0x15f3('0x3d')][_0x15f3('0x43')]({'where':{'id':_0x3cad6b[_0x15f3('0x41')]['id']}})[_0x15f3('0x23')](handleEntityNotFound(_0x43038a,null))[_0x15f3('0x23')](saveUpdates(_0x3cad6b[_0x15f3('0x46')],null))['then'](respondWithResult(_0x43038a,null))[_0x15f3('0x44')](handleError(_0x43038a,null));};exports[_0x15f3('0x22')]=function(_0x5e7e7a,_0x2a2eaa){return db[_0x15f3('0x3d')][_0x15f3('0x43')]({'where':{'id':_0x5e7e7a[_0x15f3('0x41')]['id']}})[_0x15f3('0x23')](handleEntityNotFound(_0x2a2eaa,null))[_0x15f3('0x23')](removeEntity(_0x2a2eaa,null))[_0x15f3('0x44')](handleError(_0x2a2eaa,null));};exports[_0x15f3('0x47')]=function(_0x53ea45,_0x1aad72,_0x453176){var _0x112b01=require(_0x15f3('0x48'));var _0x5c8d04=![];var _0x3a3c2e={};if(_0x53ea45['query'][_0x15f3('0x49')]&&_0x53ea45['query'][_0x15f3('0x49')]==='uniqueid'){_0x3a3c2e[_0x15f3('0x4a')]=_0x53ea45[_0x15f3('0x41')]['id'];}else{_0x3a3c2e['id']=_0x53ea45[_0x15f3('0x41')]['id'];}return db[_0x15f3('0x3d')][_0x15f3('0x43')]({'where':_0x3a3c2e,'attributes':['id',_0x15f3('0x4b'),_0x15f3('0x4c')],'raw':!![]})[_0x15f3('0x23')](handleEntityNotFound(_0x1aad72,null))['then'](function(_0x1cfe14){if(_0x1cfe14){var _0x3a419b=util['format'](_0x15f3('0x4d'),_0x1cfe14['value']);if(fs[_0x15f3('0x4e')](_0x3a419b)){_0x5c8d04=!![];return _0x112b01['decryptFile'](_0x3a419b,_0x1cfe14[_0x15f3('0x4b')],config[_0x15f3('0x4f')][_0x15f3('0x50')])[_0x15f3('0x23')](function(){return _0x1cfe14;});}return _0x1cfe14;}})['then'](function(_0x30410b){if(_0x30410b){if(!fs[_0x15f3('0x4e')](_0x30410b['savePath'])){throw new db[(_0x15f3('0x51'))][(_0x15f3('0x52'))](_0x15f3('0x53'));}if(_0x30410b[_0x15f3('0x4c')]){return _0x1aad72[_0x15f3('0x47')](_0x30410b[_0x15f3('0x4b')],_0x30410b[_0x15f3('0x4c')]+path[_0x15f3('0x54')](_0x30410b['savePath']),function(){if(_0x5c8d04){fs[_0x15f3('0x55')](_0x30410b[_0x15f3('0x4b')]);}});}else{return _0x1aad72['download'](_0x30410b[_0x15f3('0x4b')],function(_0x4e0ecd){if(_0x5c8d04){fs[_0x15f3('0x55')](_0x30410b['savePath']);}});}}})[_0x15f3('0x44')](handleError(_0x1aad72,null));};
\ No newline at end of file