Built motion from commit (unavailable).|2.5.28
[motion2.git] / server / api / attachment / attachment.controller.js
index 310bbc2..167f116 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3efa=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','name','Attachment','rawAttributes','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','params','includeAll','find','catch','clone','get','omit','createdAt','body','updatedAt','create','update','file','originalname','type','findOne','server/files/attachments/','html-pdf','rimraf','zip-dir'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x3efa,0x139));var _0xa3ef=function(_0x1a14af,_0x1eac50){_0x1a14af=_0x1a14af-0x0;var _0x45af23=_0x3efa[_0x1a14af];return _0x45af23;};'use strict';var pdf=require(_0xa3ef('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3ef('0x1'));var zipdir=require(_0xa3ef('0x2'));var jsonpatch=require(_0xa3ef('0x3'));var rp=require(_0xa3ef('0x4'));var moment=require(_0xa3ef('0x5'));var BPromise=require(_0xa3ef('0x6'));var Mustache=require(_0xa3ef('0x7'));var util=require('util');var path=require(_0xa3ef('0x8'));var sox=require(_0xa3ef('0x9'));var csv=require(_0xa3ef('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa3ef('0xb'));var squel=require(_0xa3ef('0xc'));var crypto=require(_0xa3ef('0xd'));var jsforce=require(_0xa3ef('0xe'));var deskjs=require(_0xa3ef('0xf'));var toCsv=require(_0xa3ef('0xa'));var querystring=require(_0xa3ef('0x10'));var Papa=require(_0xa3ef('0x11'));var Redis=require(_0xa3ef('0x12'));var authService=require(_0xa3ef('0x13'));var qs=require(_0xa3ef('0x14'));var as=require(_0xa3ef('0x15'));var hardwareService=require(_0xa3ef('0x16'));var logger=require('../../config/logger')(_0xa3ef('0x17'));var utils=require(_0xa3ef('0x18'));var config=require(_0xa3ef('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4752ea,_0xd8d7b0){_0xd8d7b0=_0xd8d7b0||0xcc;return function(_0x46bab8){if(_0x46bab8){return _0x4752ea[_0xa3ef('0x1a')](_0xd8d7b0);}return _0x4752ea['status'](_0xd8d7b0)[_0xa3ef('0x1b')]();};}function respondWithResult(_0xeee53d,_0x38b0a7){_0x38b0a7=_0x38b0a7||0xc8;return function(_0x38bb2e){if(_0x38bb2e){return _0xeee53d[_0xa3ef('0x1c')](_0x38b0a7)[_0xa3ef('0x1d')](_0x38bb2e);}};}function respondWithFilteredResult(_0x55cc55,_0x334f23){return function(_0x56f0a1){if(_0x56f0a1){var _0x425e36=_0x56f0a1[_0xa3ef('0x1e')],_0x320e4a=_0x334f23[_0xa3ef('0x1f')],_0x5468e4=_0x334f23[_0xa3ef('0x1f')]+_0x334f23[_0xa3ef('0x20')],_0xd8c73a;if(_0x5468e4>=_0x425e36){_0x5468e4=_0x425e36;_0xd8c73a=0xc8;}else{_0xd8c73a=0xce;}_0x55cc55[_0xa3ef('0x1c')](_0xd8c73a);return _0x55cc55[_0xa3ef('0x21')](_0xa3ef('0x22'),_0x320e4a+'-'+_0x5468e4+'/'+_0x425e36)[_0xa3ef('0x1d')](_0x56f0a1);}return null;};}function patchUpdates(_0x54b5ad){return function(_0x26e1b3){try{jsonpatch[_0xa3ef('0x23')](_0x26e1b3,_0x54b5ad,!![]);}catch(_0x22635c){return BPromise[_0xa3ef('0x24')](_0x22635c);}return _0x26e1b3[_0xa3ef('0x25')]();};}function saveUpdates(_0x325953,_0xbacfbb){return function(_0x3b182a){if(_0x3b182a){return _0x3b182a['update'](_0x325953)[_0xa3ef('0x26')](function(_0x329e9d){return _0x329e9d;});}return null;};}function removeEntity(_0x494f3b,_0x1d8375){return function(_0x1d050d){if(_0x1d050d){return _0x1d050d[_0xa3ef('0x27')]()[_0xa3ef('0x26')](function(){_0x494f3b[_0xa3ef('0x1c')](0xcc)[_0xa3ef('0x1b')]();});}};}function handleEntityNotFound(_0x246b80,_0x523e0f){return function(_0x116294){if(!_0x116294){_0x246b80[_0xa3ef('0x1a')](0x194);}return _0x116294;};}function handleError(_0x1a35f4,_0x53aee5){_0x53aee5=_0x53aee5||0x1f4;return function(_0x4dc7df){logger['error'](_0x4dc7df['stack']);if(_0x4dc7df[_0xa3ef('0x28')]){delete _0x4dc7df['name'];}_0x1a35f4[_0xa3ef('0x1c')](_0x53aee5)['send'](_0x4dc7df);};}exports['index']=function(_0x56cd6f,_0x1821eb){var _0x267fa1={},_0x361ea2={},_0x25199a={'count':0x0,'rows':[]};var _0x5076c6=_['map'](db[_0xa3ef('0x29')][_0xa3ef('0x2a')],function(_0x298b66){return{'name':_0x298b66['fieldName'],'type':_0x298b66['type']['key']};});_0x361ea2[_0xa3ef('0x2b')]=_[_0xa3ef('0x2c')](_0x5076c6,_0xa3ef('0x28'));_0x361ea2[_0xa3ef('0x2d')]=_[_0xa3ef('0x2e')](_0x56cd6f[_0xa3ef('0x2d')]);_0x361ea2[_0xa3ef('0x2f')]=_['intersection'](_0x361ea2[_0xa3ef('0x2b')],_0x361ea2['query']);_0x267fa1[_0xa3ef('0x30')]=_[_0xa3ef('0x31')](_0x361ea2[_0xa3ef('0x2b')],qs[_0xa3ef('0x32')](_0x56cd6f[_0xa3ef('0x2d')][_0xa3ef('0x32')]));_0x267fa1[_0xa3ef('0x30')]=_0x267fa1[_0xa3ef('0x30')][_0xa3ef('0x33')]?_0x267fa1['attributes']:_0x361ea2[_0xa3ef('0x2b')];if(!_0x56cd6f[_0xa3ef('0x2d')][_0xa3ef('0x34')](_0xa3ef('0x35'))){_0x267fa1[_0xa3ef('0x20')]=qs['limit'](_0x56cd6f['query'][_0xa3ef('0x20')]);_0x267fa1['offset']=qs[_0xa3ef('0x1f')](_0x56cd6f[_0xa3ef('0x2d')][_0xa3ef('0x1f')]);}_0x267fa1[_0xa3ef('0x36')]=qs['sort'](_0x56cd6f[_0xa3ef('0x2d')][_0xa3ef('0x37')]);_0x267fa1['where']=qs['filters'](_[_0xa3ef('0x38')](_0x56cd6f[_0xa3ef('0x2d')],_0x361ea2[_0xa3ef('0x2f')]));if(_0x56cd6f[_0xa3ef('0x2d')][_0xa3ef('0x39')]){_0x267fa1[_0xa3ef('0x3a')]=_[_0xa3ef('0x3b')](_0x267fa1[_0xa3ef('0x3a')],{'$or':_[_0xa3ef('0x2c')](_0x5076c6,function(_0x5511a2){if(_0x5511a2['type']!=='VIRTUAL'){var _0x381d3b={};_0x381d3b[_0x5511a2[_0xa3ef('0x28')]]={'$like':'%'+_0x56cd6f[_0xa3ef('0x2d')]['filter']+'%'};return _0x381d3b;}})});}_0x267fa1=_[_0xa3ef('0x3b')]({},_0x267fa1,_0x56cd6f[_0xa3ef('0x3c')]);var _0x3e1311={'where':_0x267fa1[_0xa3ef('0x3a')]};return db[_0xa3ef('0x29')][_0xa3ef('0x1e')](_0x3e1311)[_0xa3ef('0x26')](function(_0x244949){_0x25199a[_0xa3ef('0x1e')]=_0x244949;if(_0x56cd6f[_0xa3ef('0x2d')]['includeAll']){_0x267fa1[_0xa3ef('0x3d')]=[{'all':!![]}];}return db[_0xa3ef('0x29')]['findAll'](_0x267fa1);})['then'](function(_0x18a074){_0x25199a['rows']=_0x18a074;return _0x25199a;})['then'](respondWithFilteredResult(_0x1821eb,_0x267fa1))['catch'](handleError(_0x1821eb,null));};exports['show']=function(_0x1fb988,_0x814fb){var _0x418980={'raw':!![],'where':{'id':_0x1fb988[_0xa3ef('0x3e')]['id']}},_0x1ede85={};_0x1ede85[_0xa3ef('0x2b')]=_[_0xa3ef('0x2e')](db[_0xa3ef('0x29')][_0xa3ef('0x2a')]);_0x1ede85[_0xa3ef('0x2d')]=_[_0xa3ef('0x2e')](_0x1fb988[_0xa3ef('0x2d')]);_0x1ede85[_0xa3ef('0x2f')]=_[_0xa3ef('0x31')](_0x1ede85[_0xa3ef('0x2b')],_0x1ede85[_0xa3ef('0x2d')]);_0x418980['attributes']=_[_0xa3ef('0x31')](_0x1ede85[_0xa3ef('0x2b')],qs[_0xa3ef('0x32')](_0x1fb988[_0xa3ef('0x2d')]['fields']));_0x418980['attributes']=_0x418980[_0xa3ef('0x30')][_0xa3ef('0x33')]?_0x418980[_0xa3ef('0x30')]:_0x1ede85[_0xa3ef('0x2b')];if(_0x1fb988[_0xa3ef('0x2d')][_0xa3ef('0x3f')]){_0x418980[_0xa3ef('0x3d')]=[{'all':!![]}];}_0x418980=_[_0xa3ef('0x3b')]({},_0x418980,_0x1fb988[_0xa3ef('0x3c')]);return db[_0xa3ef('0x29')][_0xa3ef('0x40')](_0x418980)[_0xa3ef('0x26')](handleEntityNotFound(_0x814fb,null))[_0xa3ef('0x26')](respondWithResult(_0x814fb,null))[_0xa3ef('0x41')](handleError(_0x814fb,null));};exports[_0xa3ef('0x42')]=function(_0x3489d2,_0x209a1f){var _0x285010={'where':{'id':_0x3489d2[_0xa3ef('0x3e')]['id']}},_0x2e789e={};_0x2e789e[_0xa3ef('0x2b')]=_[_0xa3ef('0x2e')](db[_0xa3ef('0x29')]['rawAttributes']);_0x285010[_0xa3ef('0x30')]=_[_0xa3ef('0x31')](_0x2e789e[_0xa3ef('0x2b')],qs[_0xa3ef('0x32')](_0x3489d2['query'][_0xa3ef('0x32')]));_0x285010[_0xa3ef('0x30')]=_0x285010['attributes'][_0xa3ef('0x33')]?_0x285010[_0xa3ef('0x30')]:_0x2e789e[_0xa3ef('0x2b')];if(_0x3489d2[_0xa3ef('0x2d')][_0xa3ef('0x3f')]){_0x285010[_0xa3ef('0x3d')]=[{'all':!![]}];}_0x285010=_[_0xa3ef('0x3b')]({},_0x285010,_0x3489d2[_0xa3ef('0x3c')]);return db[_0xa3ef('0x29')]['find'](_0x285010)[_0xa3ef('0x26')](handleEntityNotFound(_0x209a1f,null))[_0xa3ef('0x26')](function(_0x225f8a){if(_0x225f8a){var _0x9e549a=_0x225f8a[_0xa3ef('0x43')]({'plain':!![]});_0x9e549a=qs[_0xa3ef('0x44')](_0x9e549a,['id',_0xa3ef('0x45'),'updatedAt']);_0x3489d2[_0xa3ef('0x46')]=_['omit'](_0x3489d2[_0xa3ef('0x46')],['id','createdAt',_0xa3ef('0x47')]);return db[_0xa3ef('0x29')][_0xa3ef('0x48')](_['merge'](_0x9e549a,_0x3489d2['body']),{'include':_0x3489d2[_0xa3ef('0x2d')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xa3ef('0x26')](respondWithResult(_0x209a1f,0xc9))[_0xa3ef('0x41')](handleError(_0x209a1f,null));};exports[_0xa3ef('0x49')]=function(_0x5557e2,_0x6dbbff){if(_0x5557e2[_0xa3ef('0x46')]['id']){delete _0x5557e2[_0xa3ef('0x46')]['id'];}return db[_0xa3ef('0x29')][_0xa3ef('0x40')]({'where':{'id':_0x5557e2['params']['id']}})[_0xa3ef('0x26')](handleEntityNotFound(_0x6dbbff,null))[_0xa3ef('0x26')](saveUpdates(_0x5557e2[_0xa3ef('0x46')],null))[_0xa3ef('0x26')](respondWithResult(_0x6dbbff,null))['catch'](handleError(_0x6dbbff,null));};exports[_0xa3ef('0x27')]=function(_0x26158e,_0x441fc4){return db['Attachment'][_0xa3ef('0x40')]({'where':{'id':_0x26158e[_0xa3ef('0x3e')]['id']}})[_0xa3ef('0x26')](handleEntityNotFound(_0x441fc4,null))['then'](removeEntity(_0x441fc4,null))[_0xa3ef('0x41')](handleError(_0x441fc4,null));};exports['create']=function(_0x4d5d73,_0x58a0c7,_0x1b8452){_0x4d5d73[_0xa3ef('0x46')][_0xa3ef('0x28')]=_0x4d5d73[_0xa3ef('0x4a')][_0xa3ef('0x4b')];_0x4d5d73[_0xa3ef('0x46')]['basename']=_0x4d5d73[_0xa3ef('0x4a')]['filename'];_0x4d5d73[_0xa3ef('0x46')][_0xa3ef('0x4c')]=_0x4d5d73['file']['mimetype'];return db[_0xa3ef('0x29')][_0xa3ef('0x48')](_0x4d5d73['body'])[_0xa3ef('0x26')](respondWithResult(_0x58a0c7,0xc9))[_0xa3ef('0x41')](handleError(_0x58a0c7,null));};exports['download']=function(_0x2838cd,_0x49761e,_0x4e2b5b){return db[_0xa3ef('0x29')][_0xa3ef('0x4d')]({'where':{'id':_0x2838cd[_0xa3ef('0x3e')]['id']},'raw':!![]})[_0xa3ef('0x26')](handleEntityNotFound(_0x49761e,null))[_0xa3ef('0x26')](function(_0xb8a67a){if(_0xb8a67a){return _0x49761e['download'](path['join'](config['root'],_0xa3ef('0x4e'),_0xb8a67a['basename']));}})[_0xa3ef('0x41')](handleError(_0x49761e,null));};
\ No newline at end of file
+var _0x4bd3=['error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','find','params','omit','body','create','destroy','originalname','basename','filename','type','file','mimetype','download','findOne','ChatOfflineMessageId','join','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x4bd3,0x174));var _0x34bd=function(_0x334b55,_0x1f2c4d){_0x334b55=_0x334b55-0x0;var _0x52c824=_0x4bd3[_0x334b55];return _0x52c824;};'use strict';var emlformat=require(_0x34bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34bd('0x1'));var jsonpatch=require(_0x34bd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x34bd('0x3'));var util=require(_0x34bd('0x4'));var path=require(_0x34bd('0x5'));var sox=require('sox');var csv=require(_0x34bd('0x6'));var ejs=require(_0x34bd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34bd('0x8'));var squel=require(_0x34bd('0x9'));var crypto=require('crypto');var jsforce=require(_0x34bd('0xa'));var deskjs=require(_0x34bd('0xb'));var toCsv=require(_0x34bd('0x6'));var querystring=require(_0x34bd('0xc'));var Papa=require(_0x34bd('0xd'));var Redis=require(_0x34bd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x34bd('0xf'));var as=require(_0x34bd('0x10'));var hardwareService=require(_0x34bd('0x11'));var logger=require(_0x34bd('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x34bd('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275d80,_0x1f19b9){_0x1f19b9=_0x1f19b9||0xcc;return function(_0x282af4){if(_0x282af4){return _0x275d80[_0x34bd('0x14')](_0x1f19b9);}return _0x275d80[_0x34bd('0x15')](_0x1f19b9)[_0x34bd('0x16')]();};}function respondWithResult(_0x4134ee,_0x236f6b){_0x236f6b=_0x236f6b||0xc8;return function(_0xf6d2f2){if(_0xf6d2f2){return _0x4134ee['status'](_0x236f6b)[_0x34bd('0x17')](_0xf6d2f2);}};}function respondWithFilteredResult(_0x4d4955,_0x4e3886){return function(_0x6638ed){if(_0x6638ed){var _0x30b3f2=_0x6638ed[_0x34bd('0x18')],_0x280c1a=_0x4e3886[_0x34bd('0x19')],_0x2dc917=_0x4e3886[_0x34bd('0x19')]+_0x4e3886[_0x34bd('0x1a')],_0x34b91b;if(_0x2dc917>=_0x30b3f2){_0x2dc917=_0x30b3f2;_0x34b91b=0xc8;}else{_0x34b91b=0xce;}_0x4d4955[_0x34bd('0x15')](_0x34b91b);return _0x4d4955[_0x34bd('0x1b')]('Content-Range',_0x280c1a+'-'+_0x2dc917+'/'+_0x30b3f2)[_0x34bd('0x17')](_0x6638ed);}return null;};}function patchUpdates(_0x324f7d){return function(_0x265e70){try{jsonpatch[_0x34bd('0x1c')](_0x265e70,_0x324f7d,!![]);}catch(_0x3976e4){return BPromise[_0x34bd('0x1d')](_0x3976e4);}return _0x265e70[_0x34bd('0x1e')]();};}function saveUpdates(_0x3d5f76,_0x130bd0){return function(_0x55538e){if(_0x55538e){return _0x55538e[_0x34bd('0x1f')](_0x3d5f76)[_0x34bd('0x20')](function(_0x49f625){return _0x49f625;});}return null;};}function removeEntity(_0x14254b,_0x463224){return function(_0x5e0c06){if(_0x5e0c06){return _0x5e0c06['destroy']()['then'](function(){_0x14254b['status'](0xcc)[_0x34bd('0x16')]();});}};}function handleEntityNotFound(_0x503a60,_0x10fc4b){return function(_0x1c2282){if(!_0x1c2282){_0x503a60[_0x34bd('0x14')](0x194);}return _0x1c2282;};}function handleError(_0x5c3c85,_0x41bffd){_0x41bffd=_0x41bffd||0x1f4;return function(_0x14479a){logger[_0x34bd('0x21')](_0x14479a[_0x34bd('0x22')]);if(_0x14479a['name']){delete _0x14479a[_0x34bd('0x23')];}_0x5c3c85[_0x34bd('0x15')](_0x41bffd)[_0x34bd('0x24')](_0x14479a);};}exports[_0x34bd('0x25')]=function(_0x56baf7,_0x45b4eb){var _0x3fe8b0={},_0x5d2e3d={},_0x27747e={'count':0x0,'rows':[]};var _0x510a30=_[_0x34bd('0x26')](db[_0x34bd('0x27')][_0x34bd('0x28')],function(_0x4500c8){return{'name':_0x4500c8[_0x34bd('0x29')],'type':_0x4500c8['type'][_0x34bd('0x2a')]};});_0x5d2e3d[_0x34bd('0x2b')]=_['map'](_0x510a30,'name');_0x5d2e3d[_0x34bd('0x2c')]=_[_0x34bd('0x2d')](_0x56baf7[_0x34bd('0x2c')]);_0x5d2e3d['filters']=_['intersection'](_0x5d2e3d[_0x34bd('0x2b')],_0x5d2e3d[_0x34bd('0x2c')]);_0x3fe8b0[_0x34bd('0x2e')]=_[_0x34bd('0x2f')](_0x5d2e3d['model'],qs[_0x34bd('0x30')](_0x56baf7[_0x34bd('0x2c')][_0x34bd('0x30')]));_0x3fe8b0[_0x34bd('0x2e')]=_0x3fe8b0[_0x34bd('0x2e')][_0x34bd('0x31')]?_0x3fe8b0['attributes']:_0x5d2e3d[_0x34bd('0x2b')];if(!_0x56baf7['query'][_0x34bd('0x32')](_0x34bd('0x33'))){_0x3fe8b0[_0x34bd('0x1a')]=qs['limit'](_0x56baf7[_0x34bd('0x2c')][_0x34bd('0x1a')]);_0x3fe8b0['offset']=qs[_0x34bd('0x19')](_0x56baf7[_0x34bd('0x2c')][_0x34bd('0x19')]);}_0x3fe8b0['order']=qs[_0x34bd('0x34')](_0x56baf7[_0x34bd('0x2c')]['sort']);_0x3fe8b0[_0x34bd('0x35')]=qs[_0x34bd('0x36')](_[_0x34bd('0x37')](_0x56baf7[_0x34bd('0x2c')],_0x5d2e3d[_0x34bd('0x36')]),_0x510a30);if(_0x56baf7[_0x34bd('0x2c')]['filter']){_0x3fe8b0['where']=_['merge'](_0x3fe8b0[_0x34bd('0x35')],{'$or':_[_0x34bd('0x26')](_0x510a30,function(_0x5e30c5){if(_0x5e30c5['type']!==_0x34bd('0x38')){var _0x4f5c8f={};_0x4f5c8f[_0x5e30c5['name']]={'$like':'%'+_0x56baf7[_0x34bd('0x2c')][_0x34bd('0x39')]+'%'};return _0x4f5c8f;}})});}_0x3fe8b0=_[_0x34bd('0x3a')]({},_0x3fe8b0,_0x56baf7[_0x34bd('0x3b')]);var _0x2af1af={'where':_0x3fe8b0['where']};return db['Attachment'][_0x34bd('0x18')](_0x2af1af)['then'](function(_0xce6bc6){_0x27747e[_0x34bd('0x18')]=_0xce6bc6;if(_0x56baf7[_0x34bd('0x2c')][_0x34bd('0x3c')]){_0x3fe8b0[_0x34bd('0x3d')]=[{'all':!![]}];}return db['Attachment'][_0x34bd('0x3e')](_0x3fe8b0);})[_0x34bd('0x20')](function(_0x16858c){_0x27747e[_0x34bd('0x3f')]=_0x16858c;return _0x27747e;})['then'](respondWithFilteredResult(_0x45b4eb,_0x3fe8b0))[_0x34bd('0x40')](handleError(_0x45b4eb,null));};exports['show']=function(_0x26e268,_0x560282){var _0x561f95={'raw':!![],'where':{'id':_0x26e268['params']['id']}},_0x279765={};_0x279765[_0x34bd('0x2b')]=_[_0x34bd('0x2d')](db[_0x34bd('0x27')][_0x34bd('0x28')]);_0x279765[_0x34bd('0x2c')]=_[_0x34bd('0x2d')](_0x26e268[_0x34bd('0x2c')]);_0x279765['filters']=_['intersection'](_0x279765['model'],_0x279765[_0x34bd('0x2c')]);_0x561f95[_0x34bd('0x2e')]=_[_0x34bd('0x2f')](_0x279765[_0x34bd('0x2b')],qs['fields'](_0x26e268[_0x34bd('0x2c')][_0x34bd('0x30')]));_0x561f95[_0x34bd('0x2e')]=_0x561f95[_0x34bd('0x2e')][_0x34bd('0x31')]?_0x561f95['attributes']:_0x279765[_0x34bd('0x2b')];if(_0x26e268['query']['includeAll']){_0x561f95[_0x34bd('0x3d')]=[{'all':!![]}];}_0x561f95=_['merge']({},_0x561f95,_0x26e268[_0x34bd('0x3b')]);return db[_0x34bd('0x27')][_0x34bd('0x41')](_0x561f95)[_0x34bd('0x20')](handleEntityNotFound(_0x560282,null))[_0x34bd('0x20')](respondWithResult(_0x560282,null))['catch'](handleError(_0x560282,null));};exports['clone']=function(_0x33e8e8,_0x51f892){var _0x1f3db3={'where':{'id':_0x33e8e8[_0x34bd('0x42')]['id']}},_0x223adb={};_0x223adb['model']=_['keys'](db['Attachment']['rawAttributes']);_0x1f3db3[_0x34bd('0x2e')]=_['intersection'](_0x223adb[_0x34bd('0x2b')],qs['fields'](_0x33e8e8[_0x34bd('0x2c')][_0x34bd('0x30')]));_0x1f3db3[_0x34bd('0x2e')]=_0x1f3db3[_0x34bd('0x2e')][_0x34bd('0x31')]?_0x1f3db3['attributes']:_0x223adb[_0x34bd('0x2b')];if(_0x33e8e8[_0x34bd('0x2c')][_0x34bd('0x3c')]){_0x1f3db3[_0x34bd('0x3d')]=[{'all':!![]}];}_0x1f3db3=_[_0x34bd('0x3a')]({},_0x1f3db3,_0x33e8e8['options']);return db[_0x34bd('0x27')][_0x34bd('0x41')](_0x1f3db3)['then'](handleEntityNotFound(_0x51f892,null))[_0x34bd('0x20')](function(_0x1a935e){if(_0x1a935e){var _0x52501b=_0x1a935e['get']({'plain':!![]});_0x52501b=qs[_0x34bd('0x43')](_0x52501b,['id','createdAt','updatedAt']);_0x33e8e8[_0x34bd('0x44')]=_[_0x34bd('0x43')](_0x33e8e8['body'],['id','createdAt','updatedAt']);return db['Attachment'][_0x34bd('0x45')](_[_0x34bd('0x3a')](_0x52501b,_0x33e8e8['body']),{'include':_0x33e8e8['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0x34bd('0x20')](respondWithResult(_0x51f892,0xc9))[_0x34bd('0x40')](handleError(_0x51f892,null));};exports['update']=function(_0x162a08,_0x23b4cd){if(_0x162a08[_0x34bd('0x44')]['id']){delete _0x162a08[_0x34bd('0x44')]['id'];}return db[_0x34bd('0x27')][_0x34bd('0x41')]({'where':{'id':_0x162a08['params']['id']}})[_0x34bd('0x20')](handleEntityNotFound(_0x23b4cd,null))[_0x34bd('0x20')](saveUpdates(_0x162a08[_0x34bd('0x44')],null))[_0x34bd('0x20')](respondWithResult(_0x23b4cd,null))['catch'](handleError(_0x23b4cd,null));};exports[_0x34bd('0x46')]=function(_0x5235e4,_0x463ca0){return db['Attachment'][_0x34bd('0x41')]({'where':{'id':_0x5235e4[_0x34bd('0x42')]['id']}})[_0x34bd('0x20')](handleEntityNotFound(_0x463ca0,null))[_0x34bd('0x20')](removeEntity(_0x463ca0,null))[_0x34bd('0x40')](handleError(_0x463ca0,null));};exports[_0x34bd('0x45')]=function(_0x6db4ba,_0x28394c,_0x4768f8){_0x6db4ba[_0x34bd('0x44')][_0x34bd('0x23')]=_0x6db4ba['file'][_0x34bd('0x47')];_0x6db4ba['body'][_0x34bd('0x48')]=_0x6db4ba['file'][_0x34bd('0x49')];_0x6db4ba['body'][_0x34bd('0x4a')]=_0x6db4ba[_0x34bd('0x4b')][_0x34bd('0x4c')];return db[_0x34bd('0x27')][_0x34bd('0x45')](_0x6db4ba[_0x34bd('0x44')])[_0x34bd('0x20')](respondWithResult(_0x28394c,0xc9))[_0x34bd('0x40')](handleError(_0x28394c,null));};exports[_0x34bd('0x4d')]=function(_0x1d2bbe,_0x25a505,_0x3e65e6){return db[_0x34bd('0x27')][_0x34bd('0x4e')]({'where':{'id':_0x1d2bbe[_0x34bd('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x25a505,null))['then'](function(_0x246c52){if(_0x246c52){var _0x79e6b4=_0x246c52[_0x34bd('0x4f')]!==null;var _0x3e8c8e=path[_0x34bd('0x50')](config['root'],'server/files/attachments/');if(_0x79e6b4){_0x3e8c8e=path['join'](_0x3e8c8e,'offline-chat/');}var _0x24c635=path[_0x34bd('0x50')](_0x3e8c8e,_0x246c52['basename']);return _0x25a505[_0x34bd('0x4d')](_0x24c635);}})[_0x34bd('0x40')](handleError(_0x25a505,null));};
\ No newline at end of file