Built motion from commit fe909640.|2.6.8
[motion2.git] / server / api / attachment / attachment.controller.js
index 783d2e2..4909230 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf467=['sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','end','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','length','find','get','omit','createdAt','updatedAt','body','create','catch','file','basename','filename','mimetype','download','join','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0xb088ca,_0x319294){var _0x35526b=function(_0x2e9308){while(--_0x2e9308){_0xb088ca['push'](_0xb088ca['shift']());}};_0x35526b(++_0x319294);}(_0xf467,0x14e));var _0x7f46=function(_0x3b30f9,_0x15c674){_0x3b30f9=_0x3b30f9-0x0;var _0x590b1c=_0xf467[_0x3b30f9];return _0x590b1c;};'use strict';var pdf=require(_0x7f46('0x0'));var emlformat=require(_0x7f46('0x1'));var rimraf=require(_0x7f46('0x2'));var zipdir=require(_0x7f46('0x3'));var jsonpatch=require(_0x7f46('0x4'));var rp=require(_0x7f46('0x5'));var moment=require(_0x7f46('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7f46('0x7'));var util=require(_0x7f46('0x8'));var path=require(_0x7f46('0x9'));var sox=require(_0x7f46('0xa'));var csv=require('to-csv');var ejs=require(_0x7f46('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7f46('0xc'));var crypto=require(_0x7f46('0xd'));var jsforce=require(_0x7f46('0xe'));var deskjs=require(_0x7f46('0xf'));var toCsv=require(_0x7f46('0x10'));var querystring=require('querystring');var Papa=require(_0x7f46('0x11'));var Redis=require(_0x7f46('0x12'));var authService=require(_0x7f46('0x13'));var qs=require(_0x7f46('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f46('0x15'));var logger=require(_0x7f46('0x16'))('api');var utils=require(_0x7f46('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7f46('0x18'));var db=require(_0x7f46('0x19'))['db'];function respondWithStatusCode(_0x385637,_0x4ccc28){_0x4ccc28=_0x4ccc28||0xcc;return function(_0x21c105){if(_0x21c105){return _0x385637[_0x7f46('0x1a')](_0x4ccc28);}return _0x385637[_0x7f46('0x1b')](_0x4ccc28)['end']();};}function respondWithResult(_0x3423ac,_0x4145a4){_0x4145a4=_0x4145a4||0xc8;return function(_0x3a1fec){if(_0x3a1fec){return _0x3423ac[_0x7f46('0x1b')](_0x4145a4)[_0x7f46('0x1c')](_0x3a1fec);}};}function respondWithFilteredResult(_0x3c5054,_0xc7d47){return function(_0x47dc12){if(_0x47dc12){var _0x1bab0c=_0x47dc12[_0x7f46('0x1d')],_0x4d6338=_0xc7d47[_0x7f46('0x1e')],_0x240e90=_0xc7d47[_0x7f46('0x1e')]+_0xc7d47[_0x7f46('0x1f')],_0xe4419d;if(_0x240e90>=_0x1bab0c){_0x240e90=_0x1bab0c;_0xe4419d=0xc8;}else{_0xe4419d=0xce;}_0x3c5054[_0x7f46('0x1b')](_0xe4419d);return _0x3c5054[_0x7f46('0x20')](_0x7f46('0x21'),_0x4d6338+'-'+_0x240e90+'/'+_0x1bab0c)[_0x7f46('0x1c')](_0x47dc12);}return null;};}function patchUpdates(_0x22b1f2){return function(_0x435496){try{jsonpatch[_0x7f46('0x22')](_0x435496,_0x22b1f2,!![]);}catch(_0x40fdc4){return BPromise['reject'](_0x40fdc4);}return _0x435496['save']();};}function saveUpdates(_0x58ef36,_0x27d0d3){return function(_0x177471){if(_0x177471){return _0x177471[_0x7f46('0x23')](_0x58ef36)[_0x7f46('0x24')](function(_0x12e1e8){return _0x12e1e8;});}return null;};}function removeEntity(_0x5c69c4,_0x1ca1be){return function(_0x543918){if(_0x543918){return _0x543918[_0x7f46('0x25')]()['then'](function(){_0x5c69c4['status'](0xcc)[_0x7f46('0x26')]();});}};}function handleEntityNotFound(_0x19b5e2,_0x2b6a8a){return function(_0x43bb03){if(!_0x43bb03){_0x19b5e2[_0x7f46('0x1a')](0x194);}return _0x43bb03;};}function handleError(_0x210e67,_0x34f54d){_0x34f54d=_0x34f54d||0x1f4;return function(_0x97e0b6){logger['error'](_0x97e0b6[_0x7f46('0x27')]);if(_0x97e0b6[_0x7f46('0x28')]){delete _0x97e0b6[_0x7f46('0x28')];}_0x210e67[_0x7f46('0x1b')](_0x34f54d)[_0x7f46('0x29')](_0x97e0b6);};}exports[_0x7f46('0x2a')]=function(_0xd05368,_0x1ceb99){var _0x5f085e={},_0x538a07={},_0x2d2382={'count':0x0,'rows':[]};var _0x2c21a3=_[_0x7f46('0x2b')](db[_0x7f46('0x2c')][_0x7f46('0x2d')],function(_0x4e1c99){return{'name':_0x4e1c99[_0x7f46('0x2e')],'type':_0x4e1c99[_0x7f46('0x2f')][_0x7f46('0x30')]};});_0x538a07[_0x7f46('0x31')]=_[_0x7f46('0x2b')](_0x2c21a3,'name');_0x538a07['query']=_[_0x7f46('0x32')](_0xd05368[_0x7f46('0x33')]);_0x538a07[_0x7f46('0x34')]=_['intersection'](_0x538a07[_0x7f46('0x31')],_0x538a07[_0x7f46('0x33')]);_0x5f085e[_0x7f46('0x35')]=_[_0x7f46('0x36')](_0x538a07[_0x7f46('0x31')],qs[_0x7f46('0x37')](_0xd05368['query'][_0x7f46('0x37')]));_0x5f085e['attributes']=_0x5f085e[_0x7f46('0x35')]['length']?_0x5f085e[_0x7f46('0x35')]:_0x538a07[_0x7f46('0x31')];if(!_0xd05368[_0x7f46('0x33')][_0x7f46('0x38')](_0x7f46('0x39'))){_0x5f085e[_0x7f46('0x1f')]=qs[_0x7f46('0x1f')](_0xd05368['query'][_0x7f46('0x1f')]);_0x5f085e['offset']=qs[_0x7f46('0x1e')](_0xd05368[_0x7f46('0x33')][_0x7f46('0x1e')]);}_0x5f085e[_0x7f46('0x3a')]=qs[_0x7f46('0x3b')](_0xd05368[_0x7f46('0x33')][_0x7f46('0x3b')]);_0x5f085e[_0x7f46('0x3c')]=qs['filters'](_[_0x7f46('0x3d')](_0xd05368['query'],_0x538a07[_0x7f46('0x34')]),_0x2c21a3);if(_0xd05368[_0x7f46('0x33')][_0x7f46('0x3e')]){_0x5f085e[_0x7f46('0x3c')]=_['merge'](_0x5f085e['where'],{'$or':_[_0x7f46('0x2b')](_0x2c21a3,function(_0x5b3db3){if(_0x5b3db3[_0x7f46('0x2f')]!=='VIRTUAL'){var _0x2903d2={};_0x2903d2[_0x5b3db3[_0x7f46('0x28')]]={'$like':'%'+_0xd05368['query']['filter']+'%'};return _0x2903d2;}})});}_0x5f085e=_[_0x7f46('0x3f')]({},_0x5f085e,_0xd05368[_0x7f46('0x40')]);var _0x26cb7d={'where':_0x5f085e[_0x7f46('0x3c')]};return db[_0x7f46('0x2c')][_0x7f46('0x1d')](_0x26cb7d)[_0x7f46('0x24')](function(_0x2625f8){_0x2d2382['count']=_0x2625f8;if(_0xd05368['query'][_0x7f46('0x41')]){_0x5f085e[_0x7f46('0x42')]=[{'all':!![]}];}return db['Attachment'][_0x7f46('0x43')](_0x5f085e);})[_0x7f46('0x24')](function(_0x155ab2){_0x2d2382[_0x7f46('0x44')]=_0x155ab2;return _0x2d2382;})[_0x7f46('0x24')](respondWithFilteredResult(_0x1ceb99,_0x5f085e))['catch'](handleError(_0x1ceb99,null));};exports['show']=function(_0x12e73f,_0x5dcd13){var _0x4a53ac={'raw':!![],'where':{'id':_0x12e73f[_0x7f46('0x45')]['id']}},_0x85bc4e={};_0x85bc4e[_0x7f46('0x31')]=_[_0x7f46('0x32')](db[_0x7f46('0x2c')][_0x7f46('0x2d')]);_0x85bc4e[_0x7f46('0x33')]=_[_0x7f46('0x32')](_0x12e73f[_0x7f46('0x33')]);_0x85bc4e['filters']=_[_0x7f46('0x36')](_0x85bc4e[_0x7f46('0x31')],_0x85bc4e[_0x7f46('0x33')]);_0x4a53ac[_0x7f46('0x35')]=_[_0x7f46('0x36')](_0x85bc4e[_0x7f46('0x31')],qs[_0x7f46('0x37')](_0x12e73f[_0x7f46('0x33')][_0x7f46('0x37')]));_0x4a53ac[_0x7f46('0x35')]=_0x4a53ac['attributes'][_0x7f46('0x46')]?_0x4a53ac['attributes']:_0x85bc4e[_0x7f46('0x31')];if(_0x12e73f[_0x7f46('0x33')][_0x7f46('0x41')]){_0x4a53ac[_0x7f46('0x42')]=[{'all':!![]}];}_0x4a53ac=_[_0x7f46('0x3f')]({},_0x4a53ac,_0x12e73f[_0x7f46('0x40')]);return db[_0x7f46('0x2c')]['find'](_0x4a53ac)[_0x7f46('0x24')](handleEntityNotFound(_0x5dcd13,null))[_0x7f46('0x24')](respondWithResult(_0x5dcd13,null))['catch'](handleError(_0x5dcd13,null));};exports['clone']=function(_0x4e1331,_0x38ceb2){var _0x4b0c61={'where':{'id':_0x4e1331[_0x7f46('0x45')]['id']}},_0x277346={};_0x277346[_0x7f46('0x31')]=_[_0x7f46('0x32')](db[_0x7f46('0x2c')]['rawAttributes']);_0x4b0c61['attributes']=_[_0x7f46('0x36')](_0x277346[_0x7f46('0x31')],qs[_0x7f46('0x37')](_0x4e1331[_0x7f46('0x33')][_0x7f46('0x37')]));_0x4b0c61[_0x7f46('0x35')]=_0x4b0c61[_0x7f46('0x35')][_0x7f46('0x46')]?_0x4b0c61[_0x7f46('0x35')]:_0x277346['model'];if(_0x4e1331['query'][_0x7f46('0x41')]){_0x4b0c61[_0x7f46('0x42')]=[{'all':!![]}];}_0x4b0c61=_['merge']({},_0x4b0c61,_0x4e1331[_0x7f46('0x40')]);return db[_0x7f46('0x2c')][_0x7f46('0x47')](_0x4b0c61)[_0x7f46('0x24')](handleEntityNotFound(_0x38ceb2,null))[_0x7f46('0x24')](function(_0x5c98e8){if(_0x5c98e8){var _0x5e69b7=_0x5c98e8[_0x7f46('0x48')]({'plain':!![]});_0x5e69b7=qs[_0x7f46('0x49')](_0x5e69b7,['id',_0x7f46('0x4a'),_0x7f46('0x4b')]);_0x4e1331[_0x7f46('0x4c')]=_[_0x7f46('0x49')](_0x4e1331[_0x7f46('0x4c')],['id','createdAt',_0x7f46('0x4b')]);return db['Attachment'][_0x7f46('0x4d')](_['merge'](_0x5e69b7,_0x4e1331[_0x7f46('0x4c')]),{'include':_0x4e1331[_0x7f46('0x33')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x7f46('0x24')](respondWithResult(_0x38ceb2,0xc9))[_0x7f46('0x4e')](handleError(_0x38ceb2,null));};exports[_0x7f46('0x23')]=function(_0x661d63,_0x44de6c){if(_0x661d63[_0x7f46('0x4c')]['id']){delete _0x661d63[_0x7f46('0x4c')]['id'];}return db[_0x7f46('0x2c')][_0x7f46('0x47')]({'where':{'id':_0x661d63[_0x7f46('0x45')]['id']}})[_0x7f46('0x24')](handleEntityNotFound(_0x44de6c,null))[_0x7f46('0x24')](saveUpdates(_0x661d63[_0x7f46('0x4c')],null))['then'](respondWithResult(_0x44de6c,null))[_0x7f46('0x4e')](handleError(_0x44de6c,null));};exports[_0x7f46('0x25')]=function(_0x3bebcb,_0x24fef6){return db['Attachment']['find']({'where':{'id':_0x3bebcb[_0x7f46('0x45')]['id']}})[_0x7f46('0x24')](handleEntityNotFound(_0x24fef6,null))[_0x7f46('0x24')](removeEntity(_0x24fef6,null))['catch'](handleError(_0x24fef6,null));};exports['create']=function(_0x1e43b4,_0xe38669,_0x4d5450){_0x1e43b4[_0x7f46('0x4c')]['name']=_0x1e43b4[_0x7f46('0x4f')]['originalname'];_0x1e43b4['body'][_0x7f46('0x50')]=_0x1e43b4[_0x7f46('0x4f')][_0x7f46('0x51')];_0x1e43b4[_0x7f46('0x4c')][_0x7f46('0x2f')]=_0x1e43b4['file'][_0x7f46('0x52')];return db[_0x7f46('0x2c')][_0x7f46('0x4d')](_0x1e43b4[_0x7f46('0x4c')])['then'](respondWithResult(_0xe38669,0xc9))[_0x7f46('0x4e')](handleError(_0xe38669,null));};exports['download']=function(_0x4f6c20,_0x586611,_0x4a9338){return db['Attachment']['findOne']({'where':{'id':_0x4f6c20['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x586611,null))[_0x7f46('0x24')](function(_0x3b7f59){if(_0x3b7f59){return _0x586611[_0x7f46('0x53')](path[_0x7f46('0x54')](config['root'],_0x7f46('0x55'),_0x3b7f59[_0x7f46('0x50')]));}})['catch'](handleError(_0x586611,null));};
\ No newline at end of file
+var _0xa186=['type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','clone','get','omit','createdAt','updatedAt','body','create','basename','filename','file','download','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','Attachment','rawAttributes'];(function(_0x27ee66,_0x3adc66){var _0x2a38a4=function(_0x28e593){while(--_0x28e593){_0x27ee66['push'](_0x27ee66['shift']());}};_0x2a38a4(++_0x3adc66);}(_0xa186,0x19a));var _0x6a18=function(_0x4ee9d,_0x3e3238){_0x4ee9d=_0x4ee9d-0x0;var _0x1cf1fd=_0xa186[_0x4ee9d];return _0x1cf1fd;};'use strict';var emlformat=require(_0x6a18('0x0'));var rimraf=require(_0x6a18('0x1'));var zipdir=require(_0x6a18('0x2'));var jsonpatch=require(_0x6a18('0x3'));var rp=require(_0x6a18('0x4'));var moment=require(_0x6a18('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6a18('0x6'));var util=require(_0x6a18('0x7'));var path=require('path');var sox=require(_0x6a18('0x8'));var csv=require(_0x6a18('0x9'));var ejs=require(_0x6a18('0xa'));var fs=require('fs');var fs_extra=require(_0x6a18('0xb'));var _=require(_0x6a18('0xc'));var squel=require(_0x6a18('0xd'));var crypto=require(_0x6a18('0xe'));var jsforce=require(_0x6a18('0xf'));var deskjs=require(_0x6a18('0x10'));var toCsv=require(_0x6a18('0x9'));var querystring=require(_0x6a18('0x11'));var Papa=require(_0x6a18('0x12'));var Redis=require(_0x6a18('0x13'));var authService=require(_0x6a18('0x14'));var qs=require(_0x6a18('0x15'));var as=require(_0x6a18('0x16'));var hardwareService=require(_0x6a18('0x17'));var logger=require('../../config/logger')(_0x6a18('0x18'));var utils=require(_0x6a18('0x19'));var config=require(_0x6a18('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a18('0x1b'))['db'];function respondWithStatusCode(_0xbb480e,_0x505c3f){_0x505c3f=_0x505c3f||0xcc;return function(_0x1440ca){if(_0x1440ca){return _0xbb480e[_0x6a18('0x1c')](_0x505c3f);}return _0xbb480e[_0x6a18('0x1d')](_0x505c3f)[_0x6a18('0x1e')]();};}function respondWithResult(_0x28470a,_0x5574f8){_0x5574f8=_0x5574f8||0xc8;return function(_0x4299ed){if(_0x4299ed){return _0x28470a[_0x6a18('0x1d')](_0x5574f8)[_0x6a18('0x1f')](_0x4299ed);}};}function respondWithFilteredResult(_0x667408,_0x275709){return function(_0x25de5c){if(_0x25de5c){var _0x4e9649=typeof _0x275709[_0x6a18('0x20')]==='undefined'&&typeof _0x275709[_0x6a18('0x21')]===_0x6a18('0x22');var _0x132855=_0x25de5c['count'];var _0x406440=_0x4e9649?0x0:_0x275709[_0x6a18('0x20')];var _0x33f8bb=_0x4e9649?_0x25de5c[_0x6a18('0x23')]:_0x275709['offset']+_0x275709[_0x6a18('0x21')];var _0x55aa44;if(_0x33f8bb>=_0x132855){_0x33f8bb=_0x132855;_0x55aa44=0xc8;}else{_0x55aa44=0xce;}_0x667408[_0x6a18('0x1d')](_0x55aa44);return _0x667408[_0x6a18('0x24')](_0x6a18('0x25'),_0x406440+'-'+_0x33f8bb+'/'+_0x132855)[_0x6a18('0x1f')](_0x25de5c);}return null;};}function patchUpdates(_0x81cb22){return function(_0x41062f){try{jsonpatch[_0x6a18('0x26')](_0x41062f,_0x81cb22,!![]);}catch(_0x1c4346){return BPromise[_0x6a18('0x27')](_0x1c4346);}return _0x41062f[_0x6a18('0x28')]();};}function saveUpdates(_0x3f28ae,_0x16c64f){return function(_0x3be0af){if(_0x3be0af){return _0x3be0af[_0x6a18('0x29')](_0x3f28ae)['then'](function(_0x53b30d){return _0x53b30d;});}return null;};}function removeEntity(_0x164962,_0x8e3673){return function(_0x5d4991){if(_0x5d4991){return _0x5d4991[_0x6a18('0x2a')]()[_0x6a18('0x2b')](function(){_0x164962['status'](0xcc)[_0x6a18('0x1e')]();});}};}function handleEntityNotFound(_0x3f4047,_0xc57200){return function(_0x1ec7e4){if(!_0x1ec7e4){_0x3f4047[_0x6a18('0x1c')](0x194);}return _0x1ec7e4;};}function handleError(_0x16b7e5,_0x590476){_0x590476=_0x590476||0x1f4;return function(_0x23c907){logger[_0x6a18('0x2c')](_0x23c907[_0x6a18('0x2d')]);if(_0x23c907['name']){delete _0x23c907[_0x6a18('0x2e')];}_0x16b7e5[_0x6a18('0x1d')](_0x590476)[_0x6a18('0x2f')](_0x23c907);};}exports['index']=function(_0x36974c,_0x2f00a5){var _0x234aae={},_0x339e13={},_0x3660c4={'count':0x0,'rows':[]};var _0x44037b=_['map'](db[_0x6a18('0x30')][_0x6a18('0x31')],function(_0x5f25b3){return{'name':_0x5f25b3['fieldName'],'type':_0x5f25b3[_0x6a18('0x32')]['key']};});_0x339e13[_0x6a18('0x33')]=_[_0x6a18('0x34')](_0x44037b,_0x6a18('0x2e'));_0x339e13['query']=_[_0x6a18('0x35')](_0x36974c[_0x6a18('0x36')]);_0x339e13[_0x6a18('0x37')]=_[_0x6a18('0x38')](_0x339e13[_0x6a18('0x33')],_0x339e13[_0x6a18('0x36')]);_0x234aae[_0x6a18('0x39')]=_[_0x6a18('0x38')](_0x339e13[_0x6a18('0x33')],qs[_0x6a18('0x3a')](_0x36974c['query'][_0x6a18('0x3a')]));_0x234aae[_0x6a18('0x39')]=_0x234aae[_0x6a18('0x39')][_0x6a18('0x3b')]?_0x234aae[_0x6a18('0x39')]:_0x339e13[_0x6a18('0x33')];if(!_0x36974c[_0x6a18('0x36')][_0x6a18('0x3c')]('nolimit')){_0x234aae[_0x6a18('0x21')]=qs[_0x6a18('0x21')](_0x36974c[_0x6a18('0x36')]['limit']);_0x234aae[_0x6a18('0x20')]=qs[_0x6a18('0x20')](_0x36974c['query']['offset']);}_0x234aae['order']=qs[_0x6a18('0x3d')](_0x36974c[_0x6a18('0x36')][_0x6a18('0x3d')]);_0x234aae['where']=qs[_0x6a18('0x37')](_[_0x6a18('0x3e')](_0x36974c[_0x6a18('0x36')],_0x339e13[_0x6a18('0x37')]),_0x44037b);if(_0x36974c['query'][_0x6a18('0x3f')]){_0x234aae[_0x6a18('0x40')]=_[_0x6a18('0x41')](_0x234aae['where'],{'$or':_[_0x6a18('0x34')](_0x44037b,function(_0x298c12){if(_0x298c12[_0x6a18('0x32')]!==_0x6a18('0x42')){var _0x30ee46={};_0x30ee46[_0x298c12[_0x6a18('0x2e')]]={'$like':'%'+_0x36974c[_0x6a18('0x36')][_0x6a18('0x3f')]+'%'};return _0x30ee46;}})});}_0x234aae=_['merge']({},_0x234aae,_0x36974c['options']);var _0x13b01f={'where':_0x234aae['where']};return db['Attachment'][_0x6a18('0x23')](_0x13b01f)[_0x6a18('0x2b')](function(_0x21ff4c){_0x3660c4['count']=_0x21ff4c;if(_0x36974c['query'][_0x6a18('0x43')]){_0x234aae[_0x6a18('0x44')]=[{'all':!![]}];}return db['Attachment'][_0x6a18('0x45')](_0x234aae);})[_0x6a18('0x2b')](function(_0x111d00){_0x3660c4[_0x6a18('0x46')]=_0x111d00;return _0x3660c4;})[_0x6a18('0x2b')](respondWithFilteredResult(_0x2f00a5,_0x234aae))[_0x6a18('0x47')](handleError(_0x2f00a5,null));};exports[_0x6a18('0x48')]=function(_0x556f4e,_0x13e26d){var _0x26df46={'raw':!![],'where':{'id':_0x556f4e[_0x6a18('0x49')]['id']}},_0x19c67b={};_0x19c67b[_0x6a18('0x33')]=_['keys'](db[_0x6a18('0x30')][_0x6a18('0x31')]);_0x19c67b['query']=_[_0x6a18('0x35')](_0x556f4e['query']);_0x19c67b[_0x6a18('0x37')]=_['intersection'](_0x19c67b['model'],_0x19c67b[_0x6a18('0x36')]);_0x26df46[_0x6a18('0x39')]=_[_0x6a18('0x38')](_0x19c67b[_0x6a18('0x33')],qs[_0x6a18('0x3a')](_0x556f4e[_0x6a18('0x36')]['fields']));_0x26df46[_0x6a18('0x39')]=_0x26df46[_0x6a18('0x39')][_0x6a18('0x3b')]?_0x26df46['attributes']:_0x19c67b['model'];if(_0x556f4e[_0x6a18('0x36')][_0x6a18('0x43')]){_0x26df46['include']=[{'all':!![]}];}_0x26df46=_['merge']({},_0x26df46,_0x556f4e[_0x6a18('0x4a')]);return db['Attachment'][_0x6a18('0x4b')](_0x26df46)[_0x6a18('0x2b')](handleEntityNotFound(_0x13e26d,null))['then'](respondWithResult(_0x13e26d,null))[_0x6a18('0x47')](handleError(_0x13e26d,null));};exports[_0x6a18('0x4c')]=function(_0x11fdbf,_0x2bcdd6){var _0x150bba={'where':{'id':_0x11fdbf[_0x6a18('0x49')]['id']}},_0x47be04={};_0x47be04[_0x6a18('0x33')]=_[_0x6a18('0x35')](db[_0x6a18('0x30')][_0x6a18('0x31')]);_0x150bba[_0x6a18('0x39')]=_[_0x6a18('0x38')](_0x47be04[_0x6a18('0x33')],qs[_0x6a18('0x3a')](_0x11fdbf['query'][_0x6a18('0x3a')]));_0x150bba['attributes']=_0x150bba[_0x6a18('0x39')][_0x6a18('0x3b')]?_0x150bba[_0x6a18('0x39')]:_0x47be04[_0x6a18('0x33')];if(_0x11fdbf[_0x6a18('0x36')][_0x6a18('0x43')]){_0x150bba[_0x6a18('0x44')]=[{'all':!![]}];}_0x150bba=_[_0x6a18('0x41')]({},_0x150bba,_0x11fdbf[_0x6a18('0x4a')]);return db['Attachment'][_0x6a18('0x4b')](_0x150bba)['then'](handleEntityNotFound(_0x2bcdd6,null))[_0x6a18('0x2b')](function(_0x458e6c){if(_0x458e6c){var _0xbda5f1=_0x458e6c[_0x6a18('0x4d')]({'plain':!![]});_0xbda5f1=qs[_0x6a18('0x4e')](_0xbda5f1,['id',_0x6a18('0x4f'),_0x6a18('0x50')]);_0x11fdbf['body']=_[_0x6a18('0x4e')](_0x11fdbf[_0x6a18('0x51')],['id',_0x6a18('0x4f'),_0x6a18('0x50')]);return db[_0x6a18('0x30')][_0x6a18('0x52')](_[_0x6a18('0x41')](_0xbda5f1,_0x11fdbf[_0x6a18('0x51')]),{'include':_0x11fdbf[_0x6a18('0x36')][_0x6a18('0x43')]?[{'all':!![]}]:undefined});}})[_0x6a18('0x2b')](respondWithResult(_0x2bcdd6,0xc9))['catch'](handleError(_0x2bcdd6,null));};exports[_0x6a18('0x29')]=function(_0x1382c4,_0xa28d5c){if(_0x1382c4[_0x6a18('0x51')]['id']){delete _0x1382c4['body']['id'];}return db[_0x6a18('0x30')][_0x6a18('0x4b')]({'where':{'id':_0x1382c4[_0x6a18('0x49')]['id']}})['then'](handleEntityNotFound(_0xa28d5c,null))[_0x6a18('0x2b')](saveUpdates(_0x1382c4[_0x6a18('0x51')],null))['then'](respondWithResult(_0xa28d5c,null))[_0x6a18('0x47')](handleError(_0xa28d5c,null));};exports[_0x6a18('0x2a')]=function(_0x3d4c2a,_0x840ae2){return db[_0x6a18('0x30')][_0x6a18('0x4b')]({'where':{'id':_0x3d4c2a[_0x6a18('0x49')]['id']}})['then'](handleEntityNotFound(_0x840ae2,null))['then'](removeEntity(_0x840ae2,null))['catch'](handleError(_0x840ae2,null));};exports[_0x6a18('0x52')]=function(_0x29fa29,_0x49a6a2,_0x1e00c6){_0x29fa29[_0x6a18('0x51')][_0x6a18('0x2e')]=_0x29fa29['file']['originalname'];_0x29fa29[_0x6a18('0x51')][_0x6a18('0x53')]=_0x29fa29['file'][_0x6a18('0x54')];_0x29fa29[_0x6a18('0x51')][_0x6a18('0x32')]=_0x29fa29[_0x6a18('0x55')]['mimetype'];return db[_0x6a18('0x30')][_0x6a18('0x52')](_0x29fa29[_0x6a18('0x51')])[_0x6a18('0x2b')](respondWithResult(_0x49a6a2,0xc9))['catch'](handleError(_0x49a6a2,null));};exports[_0x6a18('0x56')]=function(_0x342d81,_0x47f405,_0x7d9e98){return db[_0x6a18('0x30')]['findOne']({'where':{'id':_0x342d81[_0x6a18('0x49')]['id']},'raw':!![]})[_0x6a18('0x2b')](handleEntityNotFound(_0x47f405,null))['then'](function(_0x399c48){if(_0x399c48){var _0x5c5cd4=_0x399c48[_0x6a18('0x57')]!==null;var _0x12791c=path[_0x6a18('0x58')](config[_0x6a18('0x59')],_0x6a18('0x5a'));if(_0x5c5cd4){_0x12791c=path[_0x6a18('0x58')](_0x12791c,_0x6a18('0x5b'));}var _0x3a87b2=path[_0x6a18('0x58')](_0x12791c,_0x399c48[_0x6a18('0x53')]);return _0x47f405[_0x6a18('0x56')](_0x3a87b2);}})['catch'](handleError(_0x47f405,null));};
\ No newline at end of file