Built motion from commit a61a4a20.|2.5.46
[motion2.git] / server / api / attachment / attachment.controller.js
index 783d2e2..371a9a8 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 _0x5ab8=['params','includeAll','catch','clone','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Attachment','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','show'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x5ab8,0x1c8));var _0x85ab=function(_0x4af323,_0x3da96b){_0x4af323=_0x4af323-0x0;var _0x455071=_0x5ab8[_0x4af323];return _0x455071;};'use strict';var emlformat=require(_0x85ab('0x0'));var rimraf=require(_0x85ab('0x1'));var zipdir=require(_0x85ab('0x2'));var jsonpatch=require(_0x85ab('0x3'));var rp=require(_0x85ab('0x4'));var moment=require('moment');var BPromise=require(_0x85ab('0x5'));var Mustache=require(_0x85ab('0x6'));var util=require(_0x85ab('0x7'));var path=require('path');var sox=require(_0x85ab('0x8'));var csv=require(_0x85ab('0x9'));var ejs=require(_0x85ab('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85ab('0xb'));var squel=require(_0x85ab('0xc'));var crypto=require(_0x85ab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x85ab('0xe'));var toCsv=require(_0x85ab('0x9'));var querystring=require(_0x85ab('0xf'));var Papa=require(_0x85ab('0x10'));var Redis=require('ioredis');var authService=require(_0x85ab('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x85ab('0x12'));var hardwareService=require(_0x85ab('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x85ab('0x14'));var licenseUtil=require(_0x85ab('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37489d,_0x43bb7a){_0x43bb7a=_0x43bb7a||0xcc;return function(_0x34c81f){if(_0x34c81f){return _0x37489d['sendStatus'](_0x43bb7a);}return _0x37489d[_0x85ab('0x16')](_0x43bb7a)['end']();};}function respondWithResult(_0x7e726d,_0x35cc22){_0x35cc22=_0x35cc22||0xc8;return function(_0x372a0e){if(_0x372a0e){return _0x7e726d['status'](_0x35cc22)[_0x85ab('0x17')](_0x372a0e);}};}function respondWithFilteredResult(_0x1e9b4e,_0x389fd8){return function(_0xde64e3){if(_0xde64e3){var _0x2d7072=typeof _0x389fd8[_0x85ab('0x18')]==='undefined'&&typeof _0x389fd8['limit']===_0x85ab('0x19');var _0x2724f0=_0xde64e3[_0x85ab('0x1a')];var _0xc42808=_0x2d7072?0x0:_0x389fd8[_0x85ab('0x18')];var _0x1bec44=_0x2d7072?_0xde64e3[_0x85ab('0x1a')]:_0x389fd8[_0x85ab('0x18')]+_0x389fd8['limit'];var _0x3a9e5e;if(_0x1bec44>=_0x2724f0){_0x1bec44=_0x2724f0;_0x3a9e5e=0xc8;}else{_0x3a9e5e=0xce;}_0x1e9b4e[_0x85ab('0x16')](_0x3a9e5e);return _0x1e9b4e[_0x85ab('0x1b')](_0x85ab('0x1c'),_0xc42808+'-'+_0x1bec44+'/'+_0x2724f0)['json'](_0xde64e3);}return null;};}function patchUpdates(_0x107a42){return function(_0x4e2af3){try{jsonpatch[_0x85ab('0x1d')](_0x4e2af3,_0x107a42,!![]);}catch(_0x51ad89){return BPromise[_0x85ab('0x1e')](_0x51ad89);}return _0x4e2af3[_0x85ab('0x1f')]();};}function saveUpdates(_0x2ba765,_0x105732){return function(_0x371601){if(_0x371601){return _0x371601[_0x85ab('0x20')](_0x2ba765)[_0x85ab('0x21')](function(_0xea1652){return _0xea1652;});}return null;};}function removeEntity(_0x21a0d2,_0x1dec54){return function(_0x43adbb){if(_0x43adbb){return _0x43adbb[_0x85ab('0x22')]()['then'](function(){_0x21a0d2[_0x85ab('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cf79f,_0x40b47d){return function(_0x18e05c){if(!_0x18e05c){_0x3cf79f['sendStatus'](0x194);}return _0x18e05c;};}function handleError(_0x43d722,_0x2266c6){_0x2266c6=_0x2266c6||0x1f4;return function(_0x2326ff){logger[_0x85ab('0x23')](_0x2326ff[_0x85ab('0x24')]);if(_0x2326ff[_0x85ab('0x25')]){delete _0x2326ff[_0x85ab('0x25')];}_0x43d722[_0x85ab('0x16')](_0x2266c6)[_0x85ab('0x26')](_0x2326ff);};}exports['index']=function(_0x1200dd,_0x332941){var _0x2fc5a7={},_0x591e40={},_0x6d1428={'count':0x0,'rows':[]};var _0x11f499=_[_0x85ab('0x27')](db[_0x85ab('0x28')][_0x85ab('0x29')],function(_0x3e73ba){return{'name':_0x3e73ba[_0x85ab('0x2a')],'type':_0x3e73ba['type'][_0x85ab('0x2b')]};});_0x591e40[_0x85ab('0x2c')]=_[_0x85ab('0x27')](_0x11f499,_0x85ab('0x25'));_0x591e40[_0x85ab('0x2d')]=_[_0x85ab('0x2e')](_0x1200dd[_0x85ab('0x2d')]);_0x591e40[_0x85ab('0x2f')]=_[_0x85ab('0x30')](_0x591e40[_0x85ab('0x2c')],_0x591e40[_0x85ab('0x2d')]);_0x2fc5a7['attributes']=_['intersection'](_0x591e40[_0x85ab('0x2c')],qs[_0x85ab('0x31')](_0x1200dd[_0x85ab('0x2d')][_0x85ab('0x31')]));_0x2fc5a7[_0x85ab('0x32')]=_0x2fc5a7['attributes'][_0x85ab('0x33')]?_0x2fc5a7[_0x85ab('0x32')]:_0x591e40[_0x85ab('0x2c')];if(!_0x1200dd[_0x85ab('0x2d')][_0x85ab('0x34')]('nolimit')){_0x2fc5a7[_0x85ab('0x35')]=qs[_0x85ab('0x35')](_0x1200dd['query']['limit']);_0x2fc5a7['offset']=qs[_0x85ab('0x18')](_0x1200dd[_0x85ab('0x2d')][_0x85ab('0x18')]);}_0x2fc5a7[_0x85ab('0x36')]=qs[_0x85ab('0x37')](_0x1200dd[_0x85ab('0x2d')][_0x85ab('0x37')]);_0x2fc5a7['where']=qs['filters'](_[_0x85ab('0x38')](_0x1200dd[_0x85ab('0x2d')],_0x591e40[_0x85ab('0x2f')]),_0x11f499);if(_0x1200dd[_0x85ab('0x2d')][_0x85ab('0x39')]){_0x2fc5a7[_0x85ab('0x3a')]=_[_0x85ab('0x3b')](_0x2fc5a7['where'],{'$or':_[_0x85ab('0x27')](_0x11f499,function(_0x3a2723){if(_0x3a2723[_0x85ab('0x3c')]!==_0x85ab('0x3d')){var _0x23b63c={};_0x23b63c[_0x3a2723[_0x85ab('0x25')]]={'$like':'%'+_0x1200dd['query']['filter']+'%'};return _0x23b63c;}})});}_0x2fc5a7=_['merge']({},_0x2fc5a7,_0x1200dd[_0x85ab('0x3e')]);var _0x5a59da={'where':_0x2fc5a7[_0x85ab('0x3a')]};return db['Attachment'][_0x85ab('0x1a')](_0x5a59da)[_0x85ab('0x21')](function(_0x5668a9){_0x6d1428[_0x85ab('0x1a')]=_0x5668a9;if(_0x1200dd['query']['includeAll']){_0x2fc5a7[_0x85ab('0x3f')]=[{'all':!![]}];}return db['Attachment'][_0x85ab('0x40')](_0x2fc5a7);})[_0x85ab('0x21')](function(_0x10c4fd){_0x6d1428['rows']=_0x10c4fd;return _0x6d1428;})['then'](respondWithFilteredResult(_0x332941,_0x2fc5a7))['catch'](handleError(_0x332941,null));};exports[_0x85ab('0x41')]=function(_0x549627,_0x44c528){var _0x27c558={'raw':!![],'where':{'id':_0x549627[_0x85ab('0x42')]['id']}},_0x3dceb7={};_0x3dceb7['model']=_[_0x85ab('0x2e')](db['Attachment']['rawAttributes']);_0x3dceb7[_0x85ab('0x2d')]=_[_0x85ab('0x2e')](_0x549627[_0x85ab('0x2d')]);_0x3dceb7['filters']=_[_0x85ab('0x30')](_0x3dceb7['model'],_0x3dceb7[_0x85ab('0x2d')]);_0x27c558['attributes']=_[_0x85ab('0x30')](_0x3dceb7['model'],qs['fields'](_0x549627['query'][_0x85ab('0x31')]));_0x27c558[_0x85ab('0x32')]=_0x27c558[_0x85ab('0x32')]['length']?_0x27c558['attributes']:_0x3dceb7[_0x85ab('0x2c')];if(_0x549627['query'][_0x85ab('0x43')]){_0x27c558['include']=[{'all':!![]}];}_0x27c558=_[_0x85ab('0x3b')]({},_0x27c558,_0x549627[_0x85ab('0x3e')]);return db['Attachment']['find'](_0x27c558)[_0x85ab('0x21')](handleEntityNotFound(_0x44c528,null))[_0x85ab('0x21')](respondWithResult(_0x44c528,null))[_0x85ab('0x44')](handleError(_0x44c528,null));};exports[_0x85ab('0x45')]=function(_0x10286e,_0x38d6a3){var _0x472a1f={'where':{'id':_0x10286e[_0x85ab('0x42')]['id']}},_0x3e86cd={};_0x3e86cd[_0x85ab('0x2c')]=_[_0x85ab('0x2e')](db['Attachment'][_0x85ab('0x29')]);_0x472a1f[_0x85ab('0x32')]=_[_0x85ab('0x30')](_0x3e86cd['model'],qs[_0x85ab('0x31')](_0x10286e[_0x85ab('0x2d')]['fields']));_0x472a1f[_0x85ab('0x32')]=_0x472a1f['attributes'][_0x85ab('0x33')]?_0x472a1f[_0x85ab('0x32')]:_0x3e86cd[_0x85ab('0x2c')];if(_0x10286e['query'][_0x85ab('0x43')]){_0x472a1f[_0x85ab('0x3f')]=[{'all':!![]}];}_0x472a1f=_[_0x85ab('0x3b')]({},_0x472a1f,_0x10286e[_0x85ab('0x3e')]);return db[_0x85ab('0x28')][_0x85ab('0x46')](_0x472a1f)['then'](handleEntityNotFound(_0x38d6a3,null))[_0x85ab('0x21')](function(_0x3801dc){if(_0x3801dc){var _0x56ae2f=_0x3801dc[_0x85ab('0x47')]({'plain':!![]});_0x56ae2f=qs[_0x85ab('0x48')](_0x56ae2f,['id',_0x85ab('0x49'),_0x85ab('0x4a')]);_0x10286e[_0x85ab('0x4b')]=_[_0x85ab('0x48')](_0x10286e['body'],['id',_0x85ab('0x49'),'updatedAt']);return db['Attachment'][_0x85ab('0x4c')](_[_0x85ab('0x3b')](_0x56ae2f,_0x10286e[_0x85ab('0x4b')]),{'include':_0x10286e[_0x85ab('0x2d')][_0x85ab('0x43')]?[{'all':!![]}]:undefined});}})[_0x85ab('0x21')](respondWithResult(_0x38d6a3,0xc9))[_0x85ab('0x44')](handleError(_0x38d6a3,null));};exports[_0x85ab('0x20')]=function(_0x28b623,_0x4a77b1){if(_0x28b623[_0x85ab('0x4b')]['id']){delete _0x28b623['body']['id'];}return db[_0x85ab('0x28')]['find']({'where':{'id':_0x28b623[_0x85ab('0x42')]['id']}})[_0x85ab('0x21')](handleEntityNotFound(_0x4a77b1,null))['then'](saveUpdates(_0x28b623[_0x85ab('0x4b')],null))[_0x85ab('0x21')](respondWithResult(_0x4a77b1,null))['catch'](handleError(_0x4a77b1,null));};exports[_0x85ab('0x22')]=function(_0x5e4b60,_0x500857){return db[_0x85ab('0x28')][_0x85ab('0x46')]({'where':{'id':_0x5e4b60[_0x85ab('0x42')]['id']}})[_0x85ab('0x21')](handleEntityNotFound(_0x500857,null))[_0x85ab('0x21')](removeEntity(_0x500857,null))['catch'](handleError(_0x500857,null));};exports[_0x85ab('0x4c')]=function(_0x37fdd7,_0x37da8d,_0x304689){_0x37fdd7['body'][_0x85ab('0x25')]=_0x37fdd7[_0x85ab('0x4d')][_0x85ab('0x4e')];_0x37fdd7['body'][_0x85ab('0x4f')]=_0x37fdd7[_0x85ab('0x4d')][_0x85ab('0x50')];_0x37fdd7[_0x85ab('0x4b')][_0x85ab('0x3c')]=_0x37fdd7['file'][_0x85ab('0x51')];return db['Attachment'][_0x85ab('0x4c')](_0x37fdd7[_0x85ab('0x4b')])[_0x85ab('0x21')](respondWithResult(_0x37da8d,0xc9))[_0x85ab('0x44')](handleError(_0x37da8d,null));};exports[_0x85ab('0x52')]=function(_0x459303,_0x27fd20,_0x484b81){return db[_0x85ab('0x28')][_0x85ab('0x53')]({'where':{'id':_0x459303[_0x85ab('0x42')]['id']},'raw':!![]})[_0x85ab('0x21')](handleEntityNotFound(_0x27fd20,null))[_0x85ab('0x21')](function(_0x21b9b0){if(_0x21b9b0){var _0x3b1feb=_0x21b9b0['ChatOfflineMessageId']!==null;var _0x17121a=path[_0x85ab('0x54')](config[_0x85ab('0x55')],_0x85ab('0x56'));if(_0x3b1feb){_0x17121a=path[_0x85ab('0x54')](_0x17121a,'offline-chat/');}var _0x3d4957=path[_0x85ab('0x54')](_0x17121a,_0x21b9b0[_0x85ab('0x4f')]);return _0x27fd20[_0x85ab('0x52')](_0x3d4957);}})[_0x85ab('0x44')](handleError(_0x27fd20,null));};
\ No newline at end of file