Built motion from commit 88aa8522.|2.5.37
[motion2.git] / server / api / squareRecording / squareRecording.controller.js
index 2214e61..1d44c68 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf921=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','then','error','stack','name','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','SquareRecording','includeAll','include','findAll','rows','catch','keys','find','create','update','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','fast-json-patch','request-promise'];(function(_0x557fe3,_0x1fdff7){var _0x203c68=function(_0xc3e68c){while(--_0xc3e68c){_0x557fe3['push'](_0x557fe3['shift']());}};_0x203c68(++_0x1fdff7);}(_0xf921,0x123));var _0x1f92=function(_0xe4034a,_0x3459b2){_0xe4034a=_0xe4034a-0x0;var _0x189750=_0xf921[_0xe4034a];return _0x189750;};'use strict';var emlformat=require(_0x1f92('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1f92('0x1'));var rp=require(_0x1f92('0x2'));var moment=require(_0x1f92('0x3'));var BPromise=require(_0x1f92('0x4'));var Mustache=require(_0x1f92('0x5'));var util=require(_0x1f92('0x6'));var path=require(_0x1f92('0x7'));var sox=require(_0x1f92('0x8'));var csv=require(_0x1f92('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f92('0xa'));var _=require(_0x1f92('0xb'));var squel=require(_0x1f92('0xc'));var crypto=require(_0x1f92('0xd'));var jsforce=require(_0x1f92('0xe'));var deskjs=require(_0x1f92('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1f92('0x10'));var Redis=require(_0x1f92('0x11'));var authService=require(_0x1f92('0x12'));var qs=require(_0x1f92('0x13'));var as=require(_0x1f92('0x14'));var hardwareService=require(_0x1f92('0x15'));var logger=require(_0x1f92('0x16'))(_0x1f92('0x17'));var utils=require(_0x1f92('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1f92('0x19'));var db=require(_0x1f92('0x1a'))['db'];function respondWithStatusCode(_0x594cb3,_0x204a68){_0x204a68=_0x204a68||0xcc;return function(_0x12905b){if(_0x12905b){return _0x594cb3[_0x1f92('0x1b')](_0x204a68);}return _0x594cb3[_0x1f92('0x1c')](_0x204a68)[_0x1f92('0x1d')]();};}function respondWithResult(_0x39799c,_0x18f819){_0x18f819=_0x18f819||0xc8;return function(_0x53ecce){if(_0x53ecce){return _0x39799c[_0x1f92('0x1c')](_0x18f819)[_0x1f92('0x1e')](_0x53ecce);}};}function respondWithFilteredResult(_0x3f095b,_0xf6cae8){return function(_0x483f38){if(_0x483f38){var _0x46740b=typeof _0xf6cae8[_0x1f92('0x1f')]==='undefined'&&typeof _0xf6cae8[_0x1f92('0x20')]===_0x1f92('0x21');var _0x239348=_0x483f38[_0x1f92('0x22')];var _0xe0e2b=_0x46740b?0x0:_0xf6cae8['offset'];var _0x5a90d0=_0x46740b?_0x483f38[_0x1f92('0x22')]:_0xf6cae8[_0x1f92('0x1f')]+_0xf6cae8[_0x1f92('0x20')];var _0x249a7b;if(_0x5a90d0>=_0x239348){_0x5a90d0=_0x239348;_0x249a7b=0xc8;}else{_0x249a7b=0xce;}_0x3f095b[_0x1f92('0x1c')](_0x249a7b);return _0x3f095b[_0x1f92('0x23')](_0x1f92('0x24'),_0xe0e2b+'-'+_0x5a90d0+'/'+_0x239348)[_0x1f92('0x1e')](_0x483f38);}return null;};}function patchUpdates(_0x2db76e){return function(_0x2dd5f0){try{jsonpatch[_0x1f92('0x25')](_0x2dd5f0,_0x2db76e,!![]);}catch(_0x880eef){return BPromise['reject'](_0x880eef);}return _0x2dd5f0[_0x1f92('0x26')]();};}function saveUpdates(_0x854efe,_0x442c27){return function(_0x4e5af8){if(_0x4e5af8){return _0x4e5af8['update'](_0x854efe)['then'](function(_0x37cfa4){return _0x37cfa4;});}return null;};}function removeEntity(_0x2f2caf,_0x196b6e){return function(_0x1e4fd2){if(_0x1e4fd2){return _0x1e4fd2[_0x1f92('0x27')]()[_0x1f92('0x28')](function(){_0x2f2caf['status'](0xcc)[_0x1f92('0x1d')]();});}};}function handleEntityNotFound(_0x162d60,_0x1dc33a){return function(_0x35af59){if(!_0x35af59){_0x162d60[_0x1f92('0x1b')](0x194);}return _0x35af59;};}function handleError(_0x1e501b,_0x2bfb30){_0x2bfb30=_0x2bfb30||0x1f4;return function(_0x19456c){logger[_0x1f92('0x29')](_0x19456c[_0x1f92('0x2a')]);if(_0x19456c[_0x1f92('0x2b')]){delete _0x19456c[_0x1f92('0x2b')];}_0x1e501b[_0x1f92('0x1c')](_0x2bfb30)['send'](_0x19456c);};}exports['index']=function(_0xb3f42f,_0xf21e43){var _0x426c6c={},_0x49cf77={},_0x380962={'count':0x0,'rows':[]};var _0x47a08c=_['map'](db['SquareRecording']['rawAttributes'],function(_0x409b57){return{'name':_0x409b57['fieldName'],'type':_0x409b57[_0x1f92('0x2c')][_0x1f92('0x2d')]};});_0x49cf77['model']=_['map'](_0x47a08c,'name');_0x49cf77[_0x1f92('0x2e')]=_['keys'](_0xb3f42f[_0x1f92('0x2e')]);_0x49cf77[_0x1f92('0x2f')]=_[_0x1f92('0x30')](_0x49cf77[_0x1f92('0x31')],_0x49cf77['query']);_0x426c6c[_0x1f92('0x32')]=_[_0x1f92('0x30')](_0x49cf77[_0x1f92('0x31')],qs['fields'](_0xb3f42f[_0x1f92('0x2e')][_0x1f92('0x33')]));_0x426c6c[_0x1f92('0x32')]=_0x426c6c['attributes'][_0x1f92('0x34')]?_0x426c6c['attributes']:_0x49cf77['model'];if(!_0xb3f42f[_0x1f92('0x2e')][_0x1f92('0x35')](_0x1f92('0x36'))){_0x426c6c[_0x1f92('0x20')]=qs[_0x1f92('0x20')](_0xb3f42f[_0x1f92('0x2e')]['limit']);_0x426c6c['offset']=qs[_0x1f92('0x1f')](_0xb3f42f['query'][_0x1f92('0x1f')]);}_0x426c6c['order']=qs[_0x1f92('0x37')](_0xb3f42f[_0x1f92('0x2e')][_0x1f92('0x37')]);_0x426c6c['where']=qs[_0x1f92('0x2f')](_[_0x1f92('0x38')](_0xb3f42f[_0x1f92('0x2e')],_0x49cf77[_0x1f92('0x2f')]),_0x47a08c);if(_0xb3f42f[_0x1f92('0x2e')][_0x1f92('0x39')]){_0x426c6c[_0x1f92('0x3a')]=_[_0x1f92('0x3b')](_0x426c6c[_0x1f92('0x3a')],{'$or':_['map'](_0x47a08c,function(_0xb333fd){if(_0xb333fd[_0x1f92('0x2c')]!=='VIRTUAL'){var _0xfcc37c={};_0xfcc37c[_0xb333fd[_0x1f92('0x2b')]]={'$like':'%'+_0xb3f42f[_0x1f92('0x2e')][_0x1f92('0x39')]+'%'};return _0xfcc37c;}})});}_0x426c6c=_[_0x1f92('0x3b')]({},_0x426c6c,_0xb3f42f[_0x1f92('0x3c')]);var _0x3f083f={'where':_0x426c6c['where']};return db[_0x1f92('0x3d')][_0x1f92('0x22')](_0x3f083f)[_0x1f92('0x28')](function(_0x143f2b){_0x380962[_0x1f92('0x22')]=_0x143f2b;if(_0xb3f42f['query'][_0x1f92('0x3e')]){_0x426c6c[_0x1f92('0x3f')]=[{'all':!![]}];}return db[_0x1f92('0x3d')][_0x1f92('0x40')](_0x426c6c);})['then'](function(_0x5ceb49){_0x380962[_0x1f92('0x41')]=_0x5ceb49;return _0x380962;})[_0x1f92('0x28')](respondWithFilteredResult(_0xf21e43,_0x426c6c))[_0x1f92('0x42')](handleError(_0xf21e43,null));};exports['show']=function(_0x1d4c0f,_0x578a9a){var _0x4ed536={'raw':!![],'where':{'id':_0x1d4c0f['params']['id']}},_0x363b72={};_0x363b72[_0x1f92('0x31')]=_[_0x1f92('0x43')](db['SquareRecording']['rawAttributes']);_0x363b72[_0x1f92('0x2e')]=_[_0x1f92('0x43')](_0x1d4c0f['query']);_0x363b72['filters']=_[_0x1f92('0x30')](_0x363b72[_0x1f92('0x31')],_0x363b72['query']);_0x4ed536[_0x1f92('0x32')]=_[_0x1f92('0x30')](_0x363b72[_0x1f92('0x31')],qs[_0x1f92('0x33')](_0x1d4c0f[_0x1f92('0x2e')][_0x1f92('0x33')]));_0x4ed536['attributes']=_0x4ed536[_0x1f92('0x32')][_0x1f92('0x34')]?_0x4ed536[_0x1f92('0x32')]:_0x363b72[_0x1f92('0x31')];if(_0x1d4c0f['query'][_0x1f92('0x3e')]){_0x4ed536[_0x1f92('0x3f')]=[{'all':!![]}];}_0x4ed536=_[_0x1f92('0x3b')]({},_0x4ed536,_0x1d4c0f['options']);return db[_0x1f92('0x3d')][_0x1f92('0x44')](_0x4ed536)['then'](handleEntityNotFound(_0x578a9a,null))[_0x1f92('0x28')](respondWithResult(_0x578a9a,null))[_0x1f92('0x42')](handleError(_0x578a9a,null));};exports[_0x1f92('0x45')]=function(_0x51b372,_0x2346b2){return db['SquareRecording'][_0x1f92('0x45')](_0x51b372['body'],{})['then'](respondWithResult(_0x2346b2,0xc9))['catch'](handleError(_0x2346b2,null));};exports[_0x1f92('0x46')]=function(_0x135b17,_0xb3421b){if(_0x135b17['body']['id']){delete _0x135b17[_0x1f92('0x47')]['id'];}return db[_0x1f92('0x3d')][_0x1f92('0x44')]({'where':{'id':_0x135b17[_0x1f92('0x48')]['id']}})['then'](handleEntityNotFound(_0xb3421b,null))['then'](saveUpdates(_0x135b17[_0x1f92('0x47')],null))['then'](respondWithResult(_0xb3421b,null))[_0x1f92('0x42')](handleError(_0xb3421b,null));};exports[_0x1f92('0x49')]=function(_0xd7757,_0x339dfc,_0x5a2cb8){var _0x1e063d=require(_0x1f92('0x4a'));var _0x28e502=![];var _0x25c4c5={};if(_0xd7757[_0x1f92('0x2e')][_0x1f92('0x2c')]&&_0xd7757[_0x1f92('0x2e')]['type']==='uniqueid'){_0x25c4c5[_0x1f92('0x4b')]=_0xd7757[_0x1f92('0x48')]['id'];}else{_0x25c4c5['id']=_0xd7757['params']['id'];}return db[_0x1f92('0x3d')][_0x1f92('0x44')]({'where':_0x25c4c5,'attributes':['id',_0x1f92('0x4c'),_0x1f92('0x4d')],'raw':!![]})[_0x1f92('0x28')](handleEntityNotFound(_0x339dfc,null))['then'](function(_0x25e57a){if(_0x25e57a){var _0x1a4e94=_0x25e57a[_0x1f92('0x4c')];var _0x219c85=util[_0x1f92('0x4e')](_0x1f92('0x4f'),_0x1a4e94);if(fs[_0x1f92('0x50')](_0x219c85)){_0x28e502=!![];return _0x1e063d[_0x1f92('0x51')](_0x219c85,_0x1a4e94,config[_0x1f92('0x52')][_0x1f92('0x53')])[_0x1f92('0x28')](function(){return _0x25e57a;});}return _0x25e57a;}})['then'](function(_0x56b6a3){if(_0x56b6a3){var _0xfeaa21=_0x56b6a3['savePath'];if(!fs[_0x1f92('0x50')](_0xfeaa21)){throw new db[(_0x1f92('0x54'))]['ValidationError'](_0x1f92('0x55'));}if(_0x56b6a3[_0x1f92('0x4d')]){return _0x339dfc['download'](_0xfeaa21,_0x56b6a3[_0x1f92('0x4d')]+path[_0x1f92('0x56')](_0xfeaa21),function(){if(_0x28e502){fs[_0x1f92('0x57')](_0xfeaa21);}});}else{return _0x339dfc['download'](_0xfeaa21,function(_0xe7af1e){if(_0x28e502){fs['unlink'](_0xfeaa21);}});}}})[_0x1f92('0x42')](function(_0xfe8f5b){if(_0xfe8f5b[_0x1f92('0x58')]===_0x1f92('0x55')){_0x339dfc['status'](0x194)[_0x1f92('0x59')](_0x1f92('0x5a'));}else{return handleError(_0x339dfc,null);}});};exports['destroy']=function(_0x212c32,_0x4eac4b){return db[_0x1f92('0x3d')]['find']({'where':{'id':_0x212c32[_0x1f92('0x48')]['id']}})[_0x1f92('0x28')](function(_0x27ecb0){if(_[_0x1f92('0x5b')](_0x27ecb0)){throw new ReferenceError('Entity\x20not\x20found');}return _0x27ecb0;})[_0x1f92('0x28')](function(_0x258f62){var _0x5a1455=_0x258f62[_0x1f92('0x4c')];logger[_0x1f92('0x5c')](_0x1f92('0x5d'),_0x5a1455);if(!_['isNil'](_0x258f62['savePath'])&&fs[_0x1f92('0x50')](_0x5a1455)){logger[_0x1f92('0x5c')](_0x1f92('0x5e')+_0x5a1455+_0x1f92('0x5f'));fs[_0x1f92('0x60')](_0x5a1455);}_0x5a1455=_0x5a1455+_0x1f92('0x61');if(!_['isNil'](_0x258f62[_0x1f92('0x4c')])&&fs['existsSync'](_0x5a1455)){logger['info'](_0x1f92('0x5e')+_0x5a1455+_0x1f92('0x5f'));fs[_0x1f92('0x60')](_0x5a1455);}return _0x258f62;})[_0x1f92('0x28')](function(_0x302117){if(!_0x302117)throw new InternalError();return _0x302117[_0x1f92('0x27')]();})[_0x1f92('0x28')](function(){_0x4eac4b[_0x1f92('0x1c')](0xcc)[_0x1f92('0x1d')]();})[_0x1f92('0x42')](handleError(_0x4eac4b,null));};
\ No newline at end of file
+var _0x641a=['VIRTUAL','filter','options','includeAll','include','findAll','show','keys','catch','create','body','find','params','download','uniqueid','savePath','filename','format','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','type'];(function(_0x4662e3,_0x3c9e27){var _0x3ab0e7=function(_0x5f1d33){while(--_0x5f1d33){_0x4662e3['push'](_0x4662e3['shift']());}};_0x3ab0e7(++_0x3c9e27);}(_0x641a,0x1ae));var _0xa641=function(_0x267ad4,_0x1d1b88){_0x267ad4=_0x267ad4-0x0;var _0x2f3a7b=_0x641a[_0x267ad4];return _0x2f3a7b;};'use strict';var emlformat=require(_0xa641('0x0'));var rimraf=require(_0xa641('0x1'));var zipdir=require(_0xa641('0x2'));var jsonpatch=require(_0xa641('0x3'));var rp=require(_0xa641('0x4'));var moment=require(_0xa641('0x5'));var BPromise=require(_0xa641('0x6'));var Mustache=require(_0xa641('0x7'));var util=require('util');var path=require(_0xa641('0x8'));var sox=require(_0xa641('0x9'));var csv=require(_0xa641('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa641('0xb'));var _=require(_0xa641('0xc'));var squel=require('squel');var crypto=require(_0xa641('0xd'));var jsforce=require(_0xa641('0xe'));var deskjs=require(_0xa641('0xf'));var toCsv=require(_0xa641('0xa'));var querystring=require(_0xa641('0x10'));var Papa=require(_0xa641('0x11'));var Redis=require(_0xa641('0x12'));var authService=require(_0xa641('0x13'));var qs=require(_0xa641('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa641('0x15'));var logger=require(_0xa641('0x16'))(_0xa641('0x17'));var utils=require(_0xa641('0x18'));var config=require(_0xa641('0x19'));var licenseUtil=require(_0xa641('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3811a4,_0x550be8){_0x550be8=_0x550be8||0xcc;return function(_0x1de137){if(_0x1de137){return _0x3811a4[_0xa641('0x1b')](_0x550be8);}return _0x3811a4['status'](_0x550be8)[_0xa641('0x1c')]();};}function respondWithResult(_0x240e3d,_0x5a9770){_0x5a9770=_0x5a9770||0xc8;return function(_0x230006){if(_0x230006){return _0x240e3d[_0xa641('0x1d')](_0x5a9770)[_0xa641('0x1e')](_0x230006);}};}function respondWithFilteredResult(_0xa25c9e,_0x47ead0){return function(_0x2507b4){if(_0x2507b4){var _0x4ab732=typeof _0x47ead0[_0xa641('0x1f')]===_0xa641('0x20')&&typeof _0x47ead0[_0xa641('0x21')]===_0xa641('0x20');var _0xa08834=_0x2507b4['count'];var _0x15b9f7=_0x4ab732?0x0:_0x47ead0[_0xa641('0x1f')];var _0x3e9698=_0x4ab732?_0x2507b4[_0xa641('0x22')]:_0x47ead0[_0xa641('0x1f')]+_0x47ead0['limit'];var _0x2f7926;if(_0x3e9698>=_0xa08834){_0x3e9698=_0xa08834;_0x2f7926=0xc8;}else{_0x2f7926=0xce;}_0xa25c9e['status'](_0x2f7926);return _0xa25c9e[_0xa641('0x23')](_0xa641('0x24'),_0x15b9f7+'-'+_0x3e9698+'/'+_0xa08834)['json'](_0x2507b4);}return null;};}function patchUpdates(_0x3fd0d3){return function(_0xc3bdd){try{jsonpatch[_0xa641('0x25')](_0xc3bdd,_0x3fd0d3,!![]);}catch(_0x43407d){return BPromise['reject'](_0x43407d);}return _0xc3bdd[_0xa641('0x26')]();};}function saveUpdates(_0x474d87,_0x5250a4){return function(_0x2c61a1){if(_0x2c61a1){return _0x2c61a1[_0xa641('0x27')](_0x474d87)[_0xa641('0x28')](function(_0x310c68){return _0x310c68;});}return null;};}function removeEntity(_0x3312a5,_0x4fdb91){return function(_0x1e1347){if(_0x1e1347){return _0x1e1347[_0xa641('0x29')]()['then'](function(){_0x3312a5['status'](0xcc)[_0xa641('0x1c')]();});}};}function handleEntityNotFound(_0x4ae23a,_0x4c3efb){return function(_0x52157a){if(!_0x52157a){_0x4ae23a[_0xa641('0x1b')](0x194);}return _0x52157a;};}function handleError(_0xe7f1df,_0x114f94){_0x114f94=_0x114f94||0x1f4;return function(_0x4fb602){logger['error'](_0x4fb602[_0xa641('0x2a')]);if(_0x4fb602[_0xa641('0x2b')]){delete _0x4fb602[_0xa641('0x2b')];}_0xe7f1df[_0xa641('0x1d')](_0x114f94)[_0xa641('0x2c')](_0x4fb602);};}exports[_0xa641('0x2d')]=function(_0x8ac137,_0x96538c){var _0x41854f={},_0x56ee89={},_0x59235a={'count':0x0,'rows':[]};var _0x49ab3b=_[_0xa641('0x2e')](db[_0xa641('0x2f')][_0xa641('0x30')],function(_0x4000e5){return{'name':_0x4000e5[_0xa641('0x31')],'type':_0x4000e5['type'][_0xa641('0x32')]};});_0x56ee89[_0xa641('0x33')]=_[_0xa641('0x2e')](_0x49ab3b,_0xa641('0x2b'));_0x56ee89['query']=_['keys'](_0x8ac137[_0xa641('0x34')]);_0x56ee89[_0xa641('0x35')]=_['intersection'](_0x56ee89[_0xa641('0x33')],_0x56ee89[_0xa641('0x34')]);_0x41854f[_0xa641('0x36')]=_[_0xa641('0x37')](_0x56ee89[_0xa641('0x33')],qs['fields'](_0x8ac137[_0xa641('0x34')][_0xa641('0x38')]));_0x41854f['attributes']=_0x41854f['attributes'][_0xa641('0x39')]?_0x41854f['attributes']:_0x56ee89['model'];if(!_0x8ac137[_0xa641('0x34')]['hasOwnProperty'](_0xa641('0x3a'))){_0x41854f[_0xa641('0x21')]=qs[_0xa641('0x21')](_0x8ac137[_0xa641('0x34')][_0xa641('0x21')]);_0x41854f[_0xa641('0x1f')]=qs[_0xa641('0x1f')](_0x8ac137['query'][_0xa641('0x1f')]);}_0x41854f[_0xa641('0x3b')]=qs[_0xa641('0x3c')](_0x8ac137['query'][_0xa641('0x3c')]);_0x41854f[_0xa641('0x3d')]=qs[_0xa641('0x35')](_[_0xa641('0x3e')](_0x8ac137[_0xa641('0x34')],_0x56ee89[_0xa641('0x35')]),_0x49ab3b);if(_0x8ac137[_0xa641('0x34')]['filter']){_0x41854f[_0xa641('0x3d')]=_[_0xa641('0x3f')](_0x41854f[_0xa641('0x3d')],{'$or':_[_0xa641('0x2e')](_0x49ab3b,function(_0x5360d5){if(_0x5360d5[_0xa641('0x40')]!==_0xa641('0x41')){var _0x14110b={};_0x14110b[_0x5360d5['name']]={'$like':'%'+_0x8ac137[_0xa641('0x34')][_0xa641('0x42')]+'%'};return _0x14110b;}})});}_0x41854f=_[_0xa641('0x3f')]({},_0x41854f,_0x8ac137[_0xa641('0x43')]);var _0x36b284={'where':_0x41854f[_0xa641('0x3d')]};return db[_0xa641('0x2f')][_0xa641('0x22')](_0x36b284)[_0xa641('0x28')](function(_0x3d21b1){_0x59235a[_0xa641('0x22')]=_0x3d21b1;if(_0x8ac137[_0xa641('0x34')][_0xa641('0x44')]){_0x41854f[_0xa641('0x45')]=[{'all':!![]}];}return db[_0xa641('0x2f')][_0xa641('0x46')](_0x41854f);})[_0xa641('0x28')](function(_0x48d01b){_0x59235a['rows']=_0x48d01b;return _0x59235a;})[_0xa641('0x28')](respondWithFilteredResult(_0x96538c,_0x41854f))['catch'](handleError(_0x96538c,null));};exports[_0xa641('0x47')]=function(_0x29a44f,_0xfaab63){var _0x349ca4={'raw':!![],'where':{'id':_0x29a44f['params']['id']}},_0x5b4443={};_0x5b4443[_0xa641('0x33')]=_['keys'](db[_0xa641('0x2f')][_0xa641('0x30')]);_0x5b4443[_0xa641('0x34')]=_[_0xa641('0x48')](_0x29a44f[_0xa641('0x34')]);_0x5b4443[_0xa641('0x35')]=_[_0xa641('0x37')](_0x5b4443[_0xa641('0x33')],_0x5b4443[_0xa641('0x34')]);_0x349ca4[_0xa641('0x36')]=_['intersection'](_0x5b4443[_0xa641('0x33')],qs['fields'](_0x29a44f['query'][_0xa641('0x38')]));_0x349ca4[_0xa641('0x36')]=_0x349ca4['attributes']['length']?_0x349ca4['attributes']:_0x5b4443['model'];if(_0x29a44f[_0xa641('0x34')]['includeAll']){_0x349ca4['include']=[{'all':!![]}];}_0x349ca4=_[_0xa641('0x3f')]({},_0x349ca4,_0x29a44f[_0xa641('0x43')]);return db[_0xa641('0x2f')]['find'](_0x349ca4)[_0xa641('0x28')](handleEntityNotFound(_0xfaab63,null))[_0xa641('0x28')](respondWithResult(_0xfaab63,null))[_0xa641('0x49')](handleError(_0xfaab63,null));};exports['create']=function(_0x24bd19,_0x4ac222){return db[_0xa641('0x2f')][_0xa641('0x4a')](_0x24bd19[_0xa641('0x4b')],{})[_0xa641('0x28')](respondWithResult(_0x4ac222,0xc9))[_0xa641('0x49')](handleError(_0x4ac222,null));};exports[_0xa641('0x27')]=function(_0xc6ab73,_0x2561d8){if(_0xc6ab73[_0xa641('0x4b')]['id']){delete _0xc6ab73[_0xa641('0x4b')]['id'];}return db[_0xa641('0x2f')][_0xa641('0x4c')]({'where':{'id':_0xc6ab73[_0xa641('0x4d')]['id']}})[_0xa641('0x28')](handleEntityNotFound(_0x2561d8,null))[_0xa641('0x28')](saveUpdates(_0xc6ab73[_0xa641('0x4b')],null))[_0xa641('0x28')](respondWithResult(_0x2561d8,null))[_0xa641('0x49')](handleError(_0x2561d8,null));};exports[_0xa641('0x4e')]=function(_0x9ea5ed,_0x10a72b,_0x134c6a){var _0x1bac87=require('../../components/encryptor');var _0x4a6102=![];var _0x36f892={};if(_0x9ea5ed['query'][_0xa641('0x40')]&&_0x9ea5ed[_0xa641('0x34')]['type']===_0xa641('0x4f')){_0x36f892[_0xa641('0x4f')]=_0x9ea5ed[_0xa641('0x4d')]['id'];}else{_0x36f892['id']=_0x9ea5ed[_0xa641('0x4d')]['id'];}return db[_0xa641('0x2f')][_0xa641('0x4c')]({'where':_0x36f892,'attributes':['id',_0xa641('0x50'),_0xa641('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x10a72b,null))['then'](function(_0x5195cc){if(_0x5195cc){var _0xa5fb30=_0x5195cc[_0xa641('0x50')];var _0x27984a=util[_0xa641('0x52')]('%s.cypher',_0xa5fb30);if(fs[_0xa641('0x53')](_0x27984a)){_0x4a6102=!![];return _0x1bac87[_0xa641('0x54')](_0x27984a,_0xa5fb30,config['secrets'][_0xa641('0x55')])[_0xa641('0x28')](function(){return _0x5195cc;});}return _0x5195cc;}})[_0xa641('0x28')](function(_0x5530ca){if(_0x5530ca){var _0x24ba7b=_0x5530ca['savePath'];if(!fs['existsSync'](_0x24ba7b)){throw new db[(_0xa641('0x56'))][(_0xa641('0x57'))](_0xa641('0x58'));}if(_0x5530ca['filename']){return _0x10a72b[_0xa641('0x4e')](_0x24ba7b,_0x5530ca['filename']+path[_0xa641('0x59')](_0x24ba7b),function(){if(_0x4a6102){fs[_0xa641('0x5a')](_0x24ba7b);}});}else{return _0x10a72b[_0xa641('0x4e')](_0x24ba7b,function(_0xb51a23){if(_0x4a6102){fs[_0xa641('0x5a')](_0x24ba7b);}});}}})[_0xa641('0x49')](function(_0x40ba83){if(_0x40ba83['message']==='SquareRecording\x20not\x20found'){_0x10a72b['status'](0x194)[_0xa641('0x2c')](_0xa641('0x5b'));}else{return handleError(_0x10a72b,null);}});};exports[_0xa641('0x29')]=function(_0xb33477,_0x3dfaab){return db[_0xa641('0x2f')][_0xa641('0x4c')]({'where':{'id':_0xb33477[_0xa641('0x4d')]['id']}})[_0xa641('0x28')](function(_0x1bdda4){if(_[_0xa641('0x5c')](_0x1bdda4)){throw new ReferenceError(_0xa641('0x5d'));}return _0x1bdda4;})['then'](function(_0x4501d8){var _0x5c58d0=_0x4501d8[_0xa641('0x50')];logger[_0xa641('0x5e')](_0xa641('0x5f'),_0x5c58d0);if(!_[_0xa641('0x5c')](_0x4501d8['savePath'])&&fs[_0xa641('0x53')](_0x5c58d0)){logger[_0xa641('0x5e')]('File:\x20\x22'+_0x5c58d0+_0xa641('0x60'));fs['unlinkSync'](_0x5c58d0);}_0x5c58d0=_0x5c58d0+_0xa641('0x61');if(!_[_0xa641('0x5c')](_0x4501d8[_0xa641('0x50')])&&fs[_0xa641('0x53')](_0x5c58d0)){logger[_0xa641('0x5e')](_0xa641('0x62')+_0x5c58d0+_0xa641('0x60'));fs['unlinkSync'](_0x5c58d0);}return _0x4501d8;})[_0xa641('0x28')](function(_0x34ae76){if(!_0x34ae76)throw new InternalError();return _0x34ae76[_0xa641('0x29')]();})[_0xa641('0x28')](function(){_0x3dfaab['status'](0xcc)[_0xa641('0x1c')]();})[_0xa641('0x49')](handleError(_0x3dfaab,null));};
\ No newline at end of file