Built motion from commit 3e059bc2.|2.5.32
[motion2.git] / server / api / attachment / attachment.controller.js
index 45ba3b7..1b901f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa0b0=['find','clone','get','createdAt','updatedAt','body','omit','create','destroy','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params'];(function(_0x5892ec,_0x375667){var _0xd798e2=function(_0x5202bb){while(--_0x5202bb){_0x5892ec['push'](_0x5892ec['shift']());}};_0xd798e2(++_0x375667);}(_0xa0b0,0x11c));var _0x0a0b=function(_0x3dba1b,_0x335265){_0x3dba1b=_0x3dba1b-0x0;var _0x4c75e7=_0xa0b0[_0x3dba1b];return _0x4c75e7;};'use strict';var emlformat=require(_0x0a0b('0x0'));var rimraf=require(_0x0a0b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a0b('0x2'));var rp=require(_0x0a0b('0x3'));var moment=require('moment');var BPromise=require(_0x0a0b('0x4'));var Mustache=require(_0x0a0b('0x5'));var util=require(_0x0a0b('0x6'));var path=require(_0x0a0b('0x7'));var sox=require(_0x0a0b('0x8'));var csv=require(_0x0a0b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a0b('0xa'));var _=require(_0x0a0b('0xb'));var squel=require(_0x0a0b('0xc'));var crypto=require('crypto');var jsforce=require(_0x0a0b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0a0b('0x9'));var querystring=require(_0x0a0b('0xe'));var Papa=require(_0x0a0b('0xf'));var Redis=require(_0x0a0b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0a0b('0x11'));var hardwareService=require(_0x0a0b('0x12'));var logger=require(_0x0a0b('0x13'))(_0x0a0b('0x14'));var utils=require('../../config/utils');var config=require(_0x0a0b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a0b('0x16'))['db'];function respondWithStatusCode(_0x9c867c,_0x77a8c4){_0x77a8c4=_0x77a8c4||0xcc;return function(_0x454ace){if(_0x454ace){return _0x9c867c[_0x0a0b('0x17')](_0x77a8c4);}return _0x9c867c[_0x0a0b('0x18')](_0x77a8c4)['end']();};}function respondWithResult(_0x2a07b3,_0x4e19e0){_0x4e19e0=_0x4e19e0||0xc8;return function(_0x71c4c9){if(_0x71c4c9){return _0x2a07b3[_0x0a0b('0x18')](_0x4e19e0)['json'](_0x71c4c9);}};}function respondWithFilteredResult(_0x23556c,_0xef33e7){return function(_0x41d439){if(_0x41d439){var _0x54edcd=typeof _0xef33e7[_0x0a0b('0x19')]===_0x0a0b('0x1a')&&typeof _0xef33e7['limit']===_0x0a0b('0x1a');var _0x5b2e34=_0x41d439[_0x0a0b('0x1b')];var _0x4f3b90=_0x54edcd?0x0:_0xef33e7[_0x0a0b('0x19')];var _0x37b549=_0x54edcd?_0x41d439[_0x0a0b('0x1b')]:_0xef33e7[_0x0a0b('0x19')]+_0xef33e7[_0x0a0b('0x1c')];var _0xdebf8b;if(_0x37b549>=_0x5b2e34){_0x37b549=_0x5b2e34;_0xdebf8b=0xc8;}else{_0xdebf8b=0xce;}_0x23556c[_0x0a0b('0x18')](_0xdebf8b);return _0x23556c[_0x0a0b('0x1d')](_0x0a0b('0x1e'),_0x4f3b90+'-'+_0x37b549+'/'+_0x5b2e34)['json'](_0x41d439);}return null;};}function patchUpdates(_0x16c137){return function(_0x1d1cc2){try{jsonpatch['apply'](_0x1d1cc2,_0x16c137,!![]);}catch(_0x453d5f){return BPromise[_0x0a0b('0x1f')](_0x453d5f);}return _0x1d1cc2[_0x0a0b('0x20')]();};}function saveUpdates(_0x3399b6,_0x1c2e48){return function(_0x15a89c){if(_0x15a89c){return _0x15a89c[_0x0a0b('0x21')](_0x3399b6)[_0x0a0b('0x22')](function(_0x4c5235){return _0x4c5235;});}return null;};}function removeEntity(_0x52b276,_0x31e2ab){return function(_0x15afba){if(_0x15afba){return _0x15afba['destroy']()[_0x0a0b('0x22')](function(){_0x52b276[_0x0a0b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33fce5,_0x375baf){return function(_0x35b5e1){if(!_0x35b5e1){_0x33fce5[_0x0a0b('0x17')](0x194);}return _0x35b5e1;};}function handleError(_0x256c6a,_0x29f482){_0x29f482=_0x29f482||0x1f4;return function(_0x1acde3){logger[_0x0a0b('0x23')](_0x1acde3[_0x0a0b('0x24')]);if(_0x1acde3[_0x0a0b('0x25')]){delete _0x1acde3[_0x0a0b('0x25')];}_0x256c6a[_0x0a0b('0x18')](_0x29f482)[_0x0a0b('0x26')](_0x1acde3);};}exports[_0x0a0b('0x27')]=function(_0x5531f1,_0x4153f8){var _0x4f38e5={},_0x3ba869={},_0x5f1a3b={'count':0x0,'rows':[]};var _0x3edb14=_[_0x0a0b('0x28')](db[_0x0a0b('0x29')][_0x0a0b('0x2a')],function(_0x1400a3){return{'name':_0x1400a3[_0x0a0b('0x2b')],'type':_0x1400a3[_0x0a0b('0x2c')]['key']};});_0x3ba869[_0x0a0b('0x2d')]=_['map'](_0x3edb14,_0x0a0b('0x25'));_0x3ba869['query']=_[_0x0a0b('0x2e')](_0x5531f1[_0x0a0b('0x2f')]);_0x3ba869[_0x0a0b('0x30')]=_[_0x0a0b('0x31')](_0x3ba869[_0x0a0b('0x2d')],_0x3ba869[_0x0a0b('0x2f')]);_0x4f38e5['attributes']=_['intersection'](_0x3ba869[_0x0a0b('0x2d')],qs[_0x0a0b('0x32')](_0x5531f1['query'][_0x0a0b('0x32')]));_0x4f38e5[_0x0a0b('0x33')]=_0x4f38e5['attributes'][_0x0a0b('0x34')]?_0x4f38e5[_0x0a0b('0x33')]:_0x3ba869[_0x0a0b('0x2d')];if(!_0x5531f1[_0x0a0b('0x2f')][_0x0a0b('0x35')]('nolimit')){_0x4f38e5[_0x0a0b('0x1c')]=qs['limit'](_0x5531f1[_0x0a0b('0x2f')][_0x0a0b('0x1c')]);_0x4f38e5['offset']=qs[_0x0a0b('0x19')](_0x5531f1[_0x0a0b('0x2f')][_0x0a0b('0x19')]);}_0x4f38e5[_0x0a0b('0x36')]=qs['sort'](_0x5531f1[_0x0a0b('0x2f')][_0x0a0b('0x37')]);_0x4f38e5[_0x0a0b('0x38')]=qs[_0x0a0b('0x30')](_[_0x0a0b('0x39')](_0x5531f1[_0x0a0b('0x2f')],_0x3ba869[_0x0a0b('0x30')]),_0x3edb14);if(_0x5531f1['query'][_0x0a0b('0x3a')]){_0x4f38e5[_0x0a0b('0x38')]=_[_0x0a0b('0x3b')](_0x4f38e5[_0x0a0b('0x38')],{'$or':_[_0x0a0b('0x28')](_0x3edb14,function(_0xd56ab6){if(_0xd56ab6[_0x0a0b('0x2c')]!==_0x0a0b('0x3c')){var _0x35ebf1={};_0x35ebf1[_0xd56ab6[_0x0a0b('0x25')]]={'$like':'%'+_0x5531f1[_0x0a0b('0x2f')][_0x0a0b('0x3a')]+'%'};return _0x35ebf1;}})});}_0x4f38e5=_[_0x0a0b('0x3b')]({},_0x4f38e5,_0x5531f1[_0x0a0b('0x3d')]);var _0x4efc9f={'where':_0x4f38e5[_0x0a0b('0x38')]};return db[_0x0a0b('0x29')][_0x0a0b('0x1b')](_0x4efc9f)[_0x0a0b('0x22')](function(_0x1ab828){_0x5f1a3b[_0x0a0b('0x1b')]=_0x1ab828;if(_0x5531f1[_0x0a0b('0x2f')][_0x0a0b('0x3e')]){_0x4f38e5['include']=[{'all':!![]}];}return db[_0x0a0b('0x29')][_0x0a0b('0x3f')](_0x4f38e5);})['then'](function(_0x736531){_0x5f1a3b[_0x0a0b('0x40')]=_0x736531;return _0x5f1a3b;})[_0x0a0b('0x22')](respondWithFilteredResult(_0x4153f8,_0x4f38e5))[_0x0a0b('0x41')](handleError(_0x4153f8,null));};exports[_0x0a0b('0x42')]=function(_0x127539,_0x1acb4c){var _0x117bc3={'raw':!![],'where':{'id':_0x127539[_0x0a0b('0x43')]['id']}},_0xcbe302={};_0xcbe302[_0x0a0b('0x2d')]=_[_0x0a0b('0x2e')](db[_0x0a0b('0x29')][_0x0a0b('0x2a')]);_0xcbe302['query']=_[_0x0a0b('0x2e')](_0x127539['query']);_0xcbe302[_0x0a0b('0x30')]=_[_0x0a0b('0x31')](_0xcbe302[_0x0a0b('0x2d')],_0xcbe302['query']);_0x117bc3[_0x0a0b('0x33')]=_['intersection'](_0xcbe302['model'],qs[_0x0a0b('0x32')](_0x127539[_0x0a0b('0x2f')][_0x0a0b('0x32')]));_0x117bc3[_0x0a0b('0x33')]=_0x117bc3[_0x0a0b('0x33')]['length']?_0x117bc3[_0x0a0b('0x33')]:_0xcbe302[_0x0a0b('0x2d')];if(_0x127539[_0x0a0b('0x2f')][_0x0a0b('0x3e')]){_0x117bc3['include']=[{'all':!![]}];}_0x117bc3=_[_0x0a0b('0x3b')]({},_0x117bc3,_0x127539['options']);return db[_0x0a0b('0x29')][_0x0a0b('0x44')](_0x117bc3)[_0x0a0b('0x22')](handleEntityNotFound(_0x1acb4c,null))[_0x0a0b('0x22')](respondWithResult(_0x1acb4c,null))['catch'](handleError(_0x1acb4c,null));};exports[_0x0a0b('0x45')]=function(_0x499601,_0x134d27){var _0x5c8ffd={'where':{'id':_0x499601['params']['id']}},_0x3ad1e0={};_0x3ad1e0[_0x0a0b('0x2d')]=_[_0x0a0b('0x2e')](db[_0x0a0b('0x29')][_0x0a0b('0x2a')]);_0x5c8ffd[_0x0a0b('0x33')]=_['intersection'](_0x3ad1e0['model'],qs[_0x0a0b('0x32')](_0x499601[_0x0a0b('0x2f')][_0x0a0b('0x32')]));_0x5c8ffd[_0x0a0b('0x33')]=_0x5c8ffd[_0x0a0b('0x33')][_0x0a0b('0x34')]?_0x5c8ffd[_0x0a0b('0x33')]:_0x3ad1e0['model'];if(_0x499601[_0x0a0b('0x2f')][_0x0a0b('0x3e')]){_0x5c8ffd['include']=[{'all':!![]}];}_0x5c8ffd=_['merge']({},_0x5c8ffd,_0x499601['options']);return db['Attachment'][_0x0a0b('0x44')](_0x5c8ffd)['then'](handleEntityNotFound(_0x134d27,null))[_0x0a0b('0x22')](function(_0x151846){if(_0x151846){var _0x403146=_0x151846[_0x0a0b('0x46')]({'plain':!![]});_0x403146=qs['omit'](_0x403146,['id',_0x0a0b('0x47'),_0x0a0b('0x48')]);_0x499601[_0x0a0b('0x49')]=_[_0x0a0b('0x4a')](_0x499601[_0x0a0b('0x49')],['id',_0x0a0b('0x47'),_0x0a0b('0x48')]);return db[_0x0a0b('0x29')][_0x0a0b('0x4b')](_[_0x0a0b('0x3b')](_0x403146,_0x499601['body']),{'include':_0x499601[_0x0a0b('0x2f')][_0x0a0b('0x3e')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x134d27,0xc9))[_0x0a0b('0x41')](handleError(_0x134d27,null));};exports[_0x0a0b('0x21')]=function(_0xc168b,_0x3c50c8){if(_0xc168b['body']['id']){delete _0xc168b['body']['id'];}return db[_0x0a0b('0x29')][_0x0a0b('0x44')]({'where':{'id':_0xc168b[_0x0a0b('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c50c8,null))[_0x0a0b('0x22')](saveUpdates(_0xc168b[_0x0a0b('0x49')],null))[_0x0a0b('0x22')](respondWithResult(_0x3c50c8,null))[_0x0a0b('0x41')](handleError(_0x3c50c8,null));};exports[_0x0a0b('0x4c')]=function(_0x4149c7,_0x13615d){return db['Attachment'][_0x0a0b('0x44')]({'where':{'id':_0x4149c7[_0x0a0b('0x43')]['id']}})[_0x0a0b('0x22')](handleEntityNotFound(_0x13615d,null))[_0x0a0b('0x22')](removeEntity(_0x13615d,null))['catch'](handleError(_0x13615d,null));};exports[_0x0a0b('0x4b')]=function(_0x1f66c9,_0x2b16d5,_0x11703d){_0x1f66c9['body'][_0x0a0b('0x25')]=_0x1f66c9[_0x0a0b('0x4d')][_0x0a0b('0x4e')];_0x1f66c9['body'][_0x0a0b('0x4f')]=_0x1f66c9[_0x0a0b('0x4d')][_0x0a0b('0x50')];_0x1f66c9['body'][_0x0a0b('0x2c')]=_0x1f66c9[_0x0a0b('0x4d')][_0x0a0b('0x51')];return db[_0x0a0b('0x29')][_0x0a0b('0x4b')](_0x1f66c9['body'])[_0x0a0b('0x22')](respondWithResult(_0x2b16d5,0xc9))[_0x0a0b('0x41')](handleError(_0x2b16d5,null));};exports[_0x0a0b('0x52')]=function(_0x3d6759,_0x1a21a6,_0x4c96e4){return db['Attachment'][_0x0a0b('0x53')]({'where':{'id':_0x3d6759[_0x0a0b('0x43')]['id']},'raw':!![]})[_0x0a0b('0x22')](handleEntityNotFound(_0x1a21a6,null))[_0x0a0b('0x22')](function(_0x55c40e){if(_0x55c40e){var _0x576288=_0x55c40e[_0x0a0b('0x54')]!==null;var _0x1a1c9d=path[_0x0a0b('0x55')](config[_0x0a0b('0x56')],_0x0a0b('0x57'));if(_0x576288){_0x1a1c9d=path[_0x0a0b('0x55')](_0x1a1c9d,'offline-chat/');}var _0x1b6c37=path['join'](_0x1a1c9d,_0x55c40e[_0x0a0b('0x4f')]);return _0x1a21a6[_0x0a0b('0x52')](_0x1b6c37);}})[_0x0a0b('0x41')](handleError(_0x1a21a6,null));};
\ No newline at end of file
+var _0x1135=['sort','where','pick','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','length','find','clone','get','omit','createdAt','updatedAt','body','create','originalname','file','filename','mimetype','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order'];(function(_0x4d2416,_0xb126fb){var _0x327795=function(_0x3a9f72){while(--_0x3a9f72){_0x4d2416['push'](_0x4d2416['shift']());}};_0x327795(++_0xb126fb);}(_0x1135,0x7a));var _0x5113=function(_0xcd55c4,_0x2c6f69){_0xcd55c4=_0xcd55c4-0x0;var _0x3b913d=_0x1135[_0xcd55c4];return _0x3b913d;};'use strict';var emlformat=require(_0x5113('0x0'));var rimraf=require(_0x5113('0x1'));var zipdir=require(_0x5113('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5113('0x3'));var BPromise=require(_0x5113('0x4'));var Mustache=require(_0x5113('0x5'));var util=require(_0x5113('0x6'));var path=require(_0x5113('0x7'));var sox=require(_0x5113('0x8'));var csv=require('to-csv');var ejs=require(_0x5113('0x9'));var fs=require('fs');var fs_extra=require(_0x5113('0xa'));var _=require(_0x5113('0xb'));var squel=require('squel');var crypto=require(_0x5113('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5113('0xd'));var toCsv=require(_0x5113('0xe'));var querystring=require(_0x5113('0xf'));var Papa=require(_0x5113('0x10'));var Redis=require(_0x5113('0x11'));var authService=require(_0x5113('0x12'));var qs=require(_0x5113('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5113('0x14'));var logger=require(_0x5113('0x15'))(_0x5113('0x16'));var utils=require(_0x5113('0x17'));var config=require(_0x5113('0x18'));var licenseUtil=require(_0x5113('0x19'));var db=require(_0x5113('0x1a'))['db'];function respondWithStatusCode(_0x41acb1,_0x4816b5){_0x4816b5=_0x4816b5||0xcc;return function(_0x407b1c){if(_0x407b1c){return _0x41acb1[_0x5113('0x1b')](_0x4816b5);}return _0x41acb1[_0x5113('0x1c')](_0x4816b5)[_0x5113('0x1d')]();};}function respondWithResult(_0x114e25,_0x529920){_0x529920=_0x529920||0xc8;return function(_0x238d71){if(_0x238d71){return _0x114e25[_0x5113('0x1c')](_0x529920)[_0x5113('0x1e')](_0x238d71);}};}function respondWithFilteredResult(_0x237841,_0x16db3c){return function(_0x142c4e){if(_0x142c4e){var _0x1fcb9f=typeof _0x16db3c[_0x5113('0x1f')]==='undefined'&&typeof _0x16db3c[_0x5113('0x20')]==='undefined';var _0x1fa4c1=_0x142c4e[_0x5113('0x21')];var _0x4b3486=_0x1fcb9f?0x0:_0x16db3c[_0x5113('0x1f')];var _0x5d45c0=_0x1fcb9f?_0x142c4e[_0x5113('0x21')]:_0x16db3c[_0x5113('0x1f')]+_0x16db3c[_0x5113('0x20')];var _0x592f50;if(_0x5d45c0>=_0x1fa4c1){_0x5d45c0=_0x1fa4c1;_0x592f50=0xc8;}else{_0x592f50=0xce;}_0x237841[_0x5113('0x1c')](_0x592f50);return _0x237841['set'](_0x5113('0x22'),_0x4b3486+'-'+_0x5d45c0+'/'+_0x1fa4c1)['json'](_0x142c4e);}return null;};}function patchUpdates(_0x5dedbe){return function(_0x30ac59){try{jsonpatch[_0x5113('0x23')](_0x30ac59,_0x5dedbe,!![]);}catch(_0x3aa165){return BPromise[_0x5113('0x24')](_0x3aa165);}return _0x30ac59[_0x5113('0x25')]();};}function saveUpdates(_0x303827,_0x1ef1b2){return function(_0xc44ff8){if(_0xc44ff8){return _0xc44ff8[_0x5113('0x26')](_0x303827)[_0x5113('0x27')](function(_0x59d455){return _0x59d455;});}return null;};}function removeEntity(_0x4be0c1,_0x4a8890){return function(_0x83ce17){if(_0x83ce17){return _0x83ce17[_0x5113('0x28')]()[_0x5113('0x27')](function(){_0x4be0c1[_0x5113('0x1c')](0xcc)[_0x5113('0x1d')]();});}};}function handleEntityNotFound(_0x4ad9d9,_0x20b96b){return function(_0x535037){if(!_0x535037){_0x4ad9d9['sendStatus'](0x194);}return _0x535037;};}function handleError(_0x2e5904,_0x7fc8cb){_0x7fc8cb=_0x7fc8cb||0x1f4;return function(_0x5b2fe0){logger['error'](_0x5b2fe0[_0x5113('0x29')]);if(_0x5b2fe0[_0x5113('0x2a')]){delete _0x5b2fe0[_0x5113('0x2a')];}_0x2e5904[_0x5113('0x1c')](_0x7fc8cb)[_0x5113('0x2b')](_0x5b2fe0);};}exports['index']=function(_0x2dc10b,_0x3a150a){var _0x4a8815={},_0x3824ce={},_0x3785c9={'count':0x0,'rows':[]};var _0x292d3a=_['map'](db[_0x5113('0x2c')][_0x5113('0x2d')],function(_0x84a884){return{'name':_0x84a884[_0x5113('0x2e')],'type':_0x84a884[_0x5113('0x2f')][_0x5113('0x30')]};});_0x3824ce[_0x5113('0x31')]=_['map'](_0x292d3a,'name');_0x3824ce[_0x5113('0x32')]=_[_0x5113('0x33')](_0x2dc10b[_0x5113('0x32')]);_0x3824ce[_0x5113('0x34')]=_[_0x5113('0x35')](_0x3824ce[_0x5113('0x31')],_0x3824ce[_0x5113('0x32')]);_0x4a8815[_0x5113('0x36')]=_[_0x5113('0x35')](_0x3824ce[_0x5113('0x31')],qs[_0x5113('0x37')](_0x2dc10b[_0x5113('0x32')][_0x5113('0x37')]));_0x4a8815[_0x5113('0x36')]=_0x4a8815[_0x5113('0x36')]['length']?_0x4a8815[_0x5113('0x36')]:_0x3824ce['model'];if(!_0x2dc10b[_0x5113('0x32')][_0x5113('0x38')]('nolimit')){_0x4a8815[_0x5113('0x20')]=qs[_0x5113('0x20')](_0x2dc10b[_0x5113('0x32')][_0x5113('0x20')]);_0x4a8815['offset']=qs['offset'](_0x2dc10b['query']['offset']);}_0x4a8815[_0x5113('0x39')]=qs[_0x5113('0x3a')](_0x2dc10b['query'][_0x5113('0x3a')]);_0x4a8815[_0x5113('0x3b')]=qs[_0x5113('0x34')](_[_0x5113('0x3c')](_0x2dc10b[_0x5113('0x32')],_0x3824ce[_0x5113('0x34')]),_0x292d3a);if(_0x2dc10b['query']['filter']){_0x4a8815[_0x5113('0x3b')]=_['merge'](_0x4a8815['where'],{'$or':_[_0x5113('0x3d')](_0x292d3a,function(_0x591028){if(_0x591028[_0x5113('0x2f')]!==_0x5113('0x3e')){var _0x5c8782={};_0x5c8782[_0x591028[_0x5113('0x2a')]]={'$like':'%'+_0x2dc10b[_0x5113('0x32')]['filter']+'%'};return _0x5c8782;}})});}_0x4a8815=_[_0x5113('0x3f')]({},_0x4a8815,_0x2dc10b[_0x5113('0x40')]);var _0x205d92={'where':_0x4a8815[_0x5113('0x3b')]};return db['Attachment'][_0x5113('0x21')](_0x205d92)['then'](function(_0x4263f2){_0x3785c9['count']=_0x4263f2;if(_0x2dc10b[_0x5113('0x32')][_0x5113('0x41')]){_0x4a8815[_0x5113('0x42')]=[{'all':!![]}];}return db[_0x5113('0x2c')][_0x5113('0x43')](_0x4a8815);})[_0x5113('0x27')](function(_0xa0f9f1){_0x3785c9[_0x5113('0x44')]=_0xa0f9f1;return _0x3785c9;})[_0x5113('0x27')](respondWithFilteredResult(_0x3a150a,_0x4a8815))[_0x5113('0x45')](handleError(_0x3a150a,null));};exports['show']=function(_0x3359ed,_0x1af345){var _0x12a073={'raw':!![],'where':{'id':_0x3359ed[_0x5113('0x46')]['id']}},_0x2881e0={};_0x2881e0[_0x5113('0x31')]=_[_0x5113('0x33')](db[_0x5113('0x2c')][_0x5113('0x2d')]);_0x2881e0[_0x5113('0x32')]=_[_0x5113('0x33')](_0x3359ed[_0x5113('0x32')]);_0x2881e0[_0x5113('0x34')]=_[_0x5113('0x35')](_0x2881e0[_0x5113('0x31')],_0x2881e0[_0x5113('0x32')]);_0x12a073['attributes']=_[_0x5113('0x35')](_0x2881e0[_0x5113('0x31')],qs[_0x5113('0x37')](_0x3359ed[_0x5113('0x32')][_0x5113('0x37')]));_0x12a073[_0x5113('0x36')]=_0x12a073[_0x5113('0x36')][_0x5113('0x47')]?_0x12a073[_0x5113('0x36')]:_0x2881e0[_0x5113('0x31')];if(_0x3359ed[_0x5113('0x32')]['includeAll']){_0x12a073[_0x5113('0x42')]=[{'all':!![]}];}_0x12a073=_[_0x5113('0x3f')]({},_0x12a073,_0x3359ed[_0x5113('0x40')]);return db[_0x5113('0x2c')][_0x5113('0x48')](_0x12a073)['then'](handleEntityNotFound(_0x1af345,null))[_0x5113('0x27')](respondWithResult(_0x1af345,null))[_0x5113('0x45')](handleError(_0x1af345,null));};exports[_0x5113('0x49')]=function(_0x24a127,_0x17d547){var _0x57632f={'where':{'id':_0x24a127[_0x5113('0x46')]['id']}},_0x2fd70f={};_0x2fd70f['model']=_[_0x5113('0x33')](db[_0x5113('0x2c')][_0x5113('0x2d')]);_0x57632f['attributes']=_['intersection'](_0x2fd70f[_0x5113('0x31')],qs[_0x5113('0x37')](_0x24a127[_0x5113('0x32')][_0x5113('0x37')]));_0x57632f['attributes']=_0x57632f[_0x5113('0x36')][_0x5113('0x47')]?_0x57632f[_0x5113('0x36')]:_0x2fd70f['model'];if(_0x24a127[_0x5113('0x32')][_0x5113('0x41')]){_0x57632f[_0x5113('0x42')]=[{'all':!![]}];}_0x57632f=_[_0x5113('0x3f')]({},_0x57632f,_0x24a127[_0x5113('0x40')]);return db[_0x5113('0x2c')][_0x5113('0x48')](_0x57632f)[_0x5113('0x27')](handleEntityNotFound(_0x17d547,null))[_0x5113('0x27')](function(_0x4e87a5){if(_0x4e87a5){var _0x164797=_0x4e87a5[_0x5113('0x4a')]({'plain':!![]});_0x164797=qs[_0x5113('0x4b')](_0x164797,['id',_0x5113('0x4c'),_0x5113('0x4d')]);_0x24a127[_0x5113('0x4e')]=_[_0x5113('0x4b')](_0x24a127[_0x5113('0x4e')],['id',_0x5113('0x4c'),'updatedAt']);return db[_0x5113('0x2c')]['create'](_[_0x5113('0x3f')](_0x164797,_0x24a127[_0x5113('0x4e')]),{'include':_0x24a127[_0x5113('0x32')][_0x5113('0x41')]?[{'all':!![]}]:undefined});}})[_0x5113('0x27')](respondWithResult(_0x17d547,0xc9))[_0x5113('0x45')](handleError(_0x17d547,null));};exports[_0x5113('0x26')]=function(_0x67a043,_0x315422){if(_0x67a043[_0x5113('0x4e')]['id']){delete _0x67a043[_0x5113('0x4e')]['id'];}return db[_0x5113('0x2c')][_0x5113('0x48')]({'where':{'id':_0x67a043['params']['id']}})[_0x5113('0x27')](handleEntityNotFound(_0x315422,null))[_0x5113('0x27')](saveUpdates(_0x67a043[_0x5113('0x4e')],null))[_0x5113('0x27')](respondWithResult(_0x315422,null))['catch'](handleError(_0x315422,null));};exports[_0x5113('0x28')]=function(_0x5525c5,_0x4c2083){return db['Attachment'][_0x5113('0x48')]({'where':{'id':_0x5525c5[_0x5113('0x46')]['id']}})[_0x5113('0x27')](handleEntityNotFound(_0x4c2083,null))['then'](removeEntity(_0x4c2083,null))['catch'](handleError(_0x4c2083,null));};exports[_0x5113('0x4f')]=function(_0x2825ff,_0x1eac89,_0x14dc79){_0x2825ff[_0x5113('0x4e')]['name']=_0x2825ff['file'][_0x5113('0x50')];_0x2825ff[_0x5113('0x4e')]['basename']=_0x2825ff[_0x5113('0x51')][_0x5113('0x52')];_0x2825ff[_0x5113('0x4e')][_0x5113('0x2f')]=_0x2825ff['file'][_0x5113('0x53')];return db[_0x5113('0x2c')][_0x5113('0x4f')](_0x2825ff[_0x5113('0x4e')])[_0x5113('0x27')](respondWithResult(_0x1eac89,0xc9))['catch'](handleError(_0x1eac89,null));};exports['download']=function(_0xa8dd04,_0x59b8a9,_0x3e2a28){return db[_0x5113('0x2c')]['findOne']({'where':{'id':_0xa8dd04[_0x5113('0x46')]['id']},'raw':!![]})[_0x5113('0x27')](handleEntityNotFound(_0x59b8a9,null))[_0x5113('0x27')](function(_0x56f5ba){if(_0x56f5ba){var _0x5f2b89=_0x56f5ba[_0x5113('0x54')]!==null;var _0x51cb9d=path[_0x5113('0x55')](config[_0x5113('0x56')],_0x5113('0x57'));if(_0x5f2b89){_0x51cb9d=path[_0x5113('0x55')](_0x51cb9d,_0x5113('0x58'));}var _0x5ddca8=path['join'](_0x51cb9d,_0x56f5ba[_0x5113('0x59')]);return _0x59b8a9['download'](_0x5ddca8);}})[_0x5113('0x45')](handleError(_0x59b8a9,null));};
\ No newline at end of file