Built motion from commit e02f907f.|2.6.14
[motion2.git] / server / api / attachment / attachment.controller.js
index 3ccd4b8..9af04e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f80=['length','include','merge','find','clone','get','omit','createdAt','body','updatedAt','file','basename','filename','type','mimetype','create','download','findOne','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Attachment','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','keys','rawAttributes'];(function(_0x26f155,_0x182edc){var _0x2cdd23=function(_0x104668){while(--_0x104668){_0x26f155['push'](_0x26f155['shift']());}};_0x2cdd23(++_0x182edc);}(_0x1f80,0x71));var _0x01f8=function(_0x81d01b,_0x1a8ad5){_0x81d01b=_0x81d01b-0x0;var _0x1358e3=_0x1f80[_0x81d01b];return _0x1358e3;};'use strict';var pdf=require(_0x01f8('0x0'));var emlformat=require(_0x01f8('0x1'));var rimraf=require(_0x01f8('0x2'));var zipdir=require(_0x01f8('0x3'));var jsonpatch=require(_0x01f8('0x4'));var rp=require(_0x01f8('0x5'));var moment=require('moment');var BPromise=require(_0x01f8('0x6'));var Mustache=require('mustache');var util=require(_0x01f8('0x7'));var path=require(_0x01f8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x01f8('0x9'));var fs=require('fs');var _=require(_0x01f8('0xa'));var squel=require(_0x01f8('0xb'));var crypto=require(_0x01f8('0xc'));var jsforce=require(_0x01f8('0xd'));var deskjs=require(_0x01f8('0xe'));var toCsv=require(_0x01f8('0xf'));var querystring=require(_0x01f8('0x10'));var Papa=require('papaparse');var Redis=require(_0x01f8('0x11'));var authService=require(_0x01f8('0x12'));var qs=require(_0x01f8('0x13'));var as=require(_0x01f8('0x14'));var hardwareService=require(_0x01f8('0x15'));var logger=require(_0x01f8('0x16'))(_0x01f8('0x17'));var utils=require(_0x01f8('0x18'));var config=require(_0x01f8('0x19'));var licenseUtil=require(_0x01f8('0x1a'));var db=require(_0x01f8('0x1b'))['db'];function respondWithStatusCode(_0x5ac03b,_0x4465dd){_0x4465dd=_0x4465dd||0xcc;return function(_0x42bdbb){if(_0x42bdbb){return _0x5ac03b[_0x01f8('0x1c')](_0x4465dd);}return _0x5ac03b[_0x01f8('0x1d')](_0x4465dd)[_0x01f8('0x1e')]();};}function respondWithResult(_0x3b24a0,_0x22e3b8){_0x22e3b8=_0x22e3b8||0xc8;return function(_0x3a8fa8){if(_0x3a8fa8){return _0x3b24a0['status'](_0x22e3b8)[_0x01f8('0x1f')](_0x3a8fa8);}};}function respondWithFilteredResult(_0x3bc682,_0x413f4b){return function(_0x4f7f31){if(_0x4f7f31){var _0x5baa92=_0x4f7f31['count'],_0x28e396=_0x413f4b[_0x01f8('0x20')],_0x27002c=_0x413f4b[_0x01f8('0x20')]+_0x413f4b[_0x01f8('0x21')],_0x2d2d75;if(_0x27002c>=_0x5baa92){_0x27002c=_0x5baa92;_0x2d2d75=0xc8;}else{_0x2d2d75=0xce;}_0x3bc682[_0x01f8('0x1d')](_0x2d2d75);return _0x3bc682[_0x01f8('0x22')](_0x01f8('0x23'),_0x28e396+'-'+_0x27002c+'/'+_0x5baa92)[_0x01f8('0x1f')](_0x4f7f31);}return null;};}function patchUpdates(_0x188d1c){return function(_0x339a7a){try{jsonpatch[_0x01f8('0x24')](_0x339a7a,_0x188d1c,!![]);}catch(_0xe281c7){return BPromise[_0x01f8('0x25')](_0xe281c7);}return _0x339a7a[_0x01f8('0x26')]();};}function saveUpdates(_0x3e2da9,_0x1deeb3){return function(_0x3d9115){if(_0x3d9115){return _0x3d9115[_0x01f8('0x27')](_0x3e2da9)[_0x01f8('0x28')](function(_0x25e6bf){return _0x25e6bf;});}return null;};}function removeEntity(_0xcfbd66,_0x3272ce){return function(_0x218b41){if(_0x218b41){return _0x218b41[_0x01f8('0x29')]()[_0x01f8('0x28')](function(){_0xcfbd66['status'](0xcc)[_0x01f8('0x1e')]();});}};}function handleEntityNotFound(_0x34f87f,_0x2699ef){return function(_0x1c9065){if(!_0x1c9065){_0x34f87f[_0x01f8('0x1c')](0x194);}return _0x1c9065;};}function handleError(_0x2e39bf,_0x36cd3b){_0x36cd3b=_0x36cd3b||0x1f4;return function(_0x1382ff){logger[_0x01f8('0x2a')](_0x1382ff['stack']);if(_0x1382ff[_0x01f8('0x2b')]){delete _0x1382ff[_0x01f8('0x2b')];}_0x2e39bf[_0x01f8('0x1d')](_0x36cd3b)[_0x01f8('0x2c')](_0x1382ff);};}exports[_0x01f8('0x2d')]=function(_0x397dc9,_0x5d4870){var _0x3e24e6={},_0x1f2976={},_0x4f9857={'count':0x0,'rows':[]};var _0x3e5ef0=_[_0x01f8('0x2e')](db[_0x01f8('0x2f')]['rawAttributes'],function(_0x15f2fb){return{'name':_0x15f2fb['fieldName'],'type':_0x15f2fb['type'][_0x01f8('0x30')]};});_0x1f2976[_0x01f8('0x31')]=_['map'](_0x3e5ef0,_0x01f8('0x2b'));_0x1f2976[_0x01f8('0x32')]=_['keys'](_0x397dc9['query']);_0x1f2976[_0x01f8('0x33')]=_[_0x01f8('0x34')](_0x1f2976[_0x01f8('0x31')],_0x1f2976[_0x01f8('0x32')]);_0x3e24e6[_0x01f8('0x35')]=_[_0x01f8('0x34')](_0x1f2976[_0x01f8('0x31')],qs[_0x01f8('0x36')](_0x397dc9['query']['fields']));_0x3e24e6[_0x01f8('0x35')]=_0x3e24e6[_0x01f8('0x35')]['length']?_0x3e24e6[_0x01f8('0x35')]:_0x1f2976[_0x01f8('0x31')];if(!_0x397dc9['query'][_0x01f8('0x37')](_0x01f8('0x38'))){_0x3e24e6[_0x01f8('0x21')]=qs['limit'](_0x397dc9[_0x01f8('0x32')][_0x01f8('0x21')]);_0x3e24e6[_0x01f8('0x20')]=qs[_0x01f8('0x20')](_0x397dc9[_0x01f8('0x32')]['offset']);}_0x3e24e6[_0x01f8('0x39')]=qs['sort'](_0x397dc9['query'][_0x01f8('0x3a')]);_0x3e24e6[_0x01f8('0x3b')]=qs['filters'](_[_0x01f8('0x3c')](_0x397dc9[_0x01f8('0x32')],_0x1f2976[_0x01f8('0x33')]),_0x3e5ef0);if(_0x397dc9[_0x01f8('0x32')][_0x01f8('0x3d')]){_0x3e24e6['where']=_['merge'](_0x3e24e6['where'],{'$or':_['map'](_0x3e5ef0,function(_0x3caf0a){if(_0x3caf0a['type']!==_0x01f8('0x3e')){var _0x8331a7={};_0x8331a7[_0x3caf0a['name']]={'$like':'%'+_0x397dc9[_0x01f8('0x32')][_0x01f8('0x3d')]+'%'};return _0x8331a7;}})});}_0x3e24e6=_['merge']({},_0x3e24e6,_0x397dc9[_0x01f8('0x3f')]);var _0x10d18a={'where':_0x3e24e6['where']};return db[_0x01f8('0x2f')][_0x01f8('0x40')](_0x10d18a)['then'](function(_0x97f156){_0x4f9857[_0x01f8('0x40')]=_0x97f156;if(_0x397dc9[_0x01f8('0x32')][_0x01f8('0x41')]){_0x3e24e6['include']=[{'all':!![]}];}return db['Attachment'][_0x01f8('0x42')](_0x3e24e6);})['then'](function(_0x572b67){_0x4f9857[_0x01f8('0x43')]=_0x572b67;return _0x4f9857;})['then'](respondWithFilteredResult(_0x5d4870,_0x3e24e6))[_0x01f8('0x44')](handleError(_0x5d4870,null));};exports[_0x01f8('0x45')]=function(_0x324825,_0x4bb1e9){var _0x4ef66e={'raw':!![],'where':{'id':_0x324825[_0x01f8('0x46')]['id']}},_0x241d7f={};_0x241d7f['model']=_[_0x01f8('0x47')](db[_0x01f8('0x2f')][_0x01f8('0x48')]);_0x241d7f['query']=_['keys'](_0x324825['query']);_0x241d7f[_0x01f8('0x33')]=_[_0x01f8('0x34')](_0x241d7f[_0x01f8('0x31')],_0x241d7f[_0x01f8('0x32')]);_0x4ef66e[_0x01f8('0x35')]=_[_0x01f8('0x34')](_0x241d7f['model'],qs[_0x01f8('0x36')](_0x324825[_0x01f8('0x32')]['fields']));_0x4ef66e[_0x01f8('0x35')]=_0x4ef66e[_0x01f8('0x35')][_0x01f8('0x49')]?_0x4ef66e[_0x01f8('0x35')]:_0x241d7f[_0x01f8('0x31')];if(_0x324825[_0x01f8('0x32')][_0x01f8('0x41')]){_0x4ef66e[_0x01f8('0x4a')]=[{'all':!![]}];}_0x4ef66e=_[_0x01f8('0x4b')]({},_0x4ef66e,_0x324825[_0x01f8('0x3f')]);return db[_0x01f8('0x2f')][_0x01f8('0x4c')](_0x4ef66e)[_0x01f8('0x28')](handleEntityNotFound(_0x4bb1e9,null))[_0x01f8('0x28')](respondWithResult(_0x4bb1e9,null))['catch'](handleError(_0x4bb1e9,null));};exports[_0x01f8('0x4d')]=function(_0xc008bd,_0x1ea537){var _0x18ea05={'where':{'id':_0xc008bd[_0x01f8('0x46')]['id']}},_0x971949={};_0x971949['model']=_[_0x01f8('0x47')](db[_0x01f8('0x2f')][_0x01f8('0x48')]);_0x18ea05[_0x01f8('0x35')]=_[_0x01f8('0x34')](_0x971949['model'],qs[_0x01f8('0x36')](_0xc008bd[_0x01f8('0x32')][_0x01f8('0x36')]));_0x18ea05[_0x01f8('0x35')]=_0x18ea05[_0x01f8('0x35')][_0x01f8('0x49')]?_0x18ea05[_0x01f8('0x35')]:_0x971949[_0x01f8('0x31')];if(_0xc008bd[_0x01f8('0x32')][_0x01f8('0x41')]){_0x18ea05[_0x01f8('0x4a')]=[{'all':!![]}];}_0x18ea05=_[_0x01f8('0x4b')]({},_0x18ea05,_0xc008bd[_0x01f8('0x3f')]);return db[_0x01f8('0x2f')][_0x01f8('0x4c')](_0x18ea05)['then'](handleEntityNotFound(_0x1ea537,null))[_0x01f8('0x28')](function(_0x130041){if(_0x130041){var _0x3c0b0e=_0x130041[_0x01f8('0x4e')]({'plain':!![]});_0x3c0b0e=qs[_0x01f8('0x4f')](_0x3c0b0e,['id',_0x01f8('0x50'),'updatedAt']);_0xc008bd['body']=_['omit'](_0xc008bd[_0x01f8('0x51')],['id',_0x01f8('0x50'),_0x01f8('0x52')]);return db[_0x01f8('0x2f')]['create'](_[_0x01f8('0x4b')](_0x3c0b0e,_0xc008bd[_0x01f8('0x51')]),{'include':_0xc008bd['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0x01f8('0x28')](respondWithResult(_0x1ea537,0xc9))[_0x01f8('0x44')](handleError(_0x1ea537,null));};exports[_0x01f8('0x27')]=function(_0x5ce501,_0x3e8e76){if(_0x5ce501['body']['id']){delete _0x5ce501[_0x01f8('0x51')]['id'];}return db[_0x01f8('0x2f')][_0x01f8('0x4c')]({'where':{'id':_0x5ce501[_0x01f8('0x46')]['id']}})[_0x01f8('0x28')](handleEntityNotFound(_0x3e8e76,null))[_0x01f8('0x28')](saveUpdates(_0x5ce501[_0x01f8('0x51')],null))[_0x01f8('0x28')](respondWithResult(_0x3e8e76,null))[_0x01f8('0x44')](handleError(_0x3e8e76,null));};exports[_0x01f8('0x29')]=function(_0x10fe33,_0x4851b5){return db[_0x01f8('0x2f')]['find']({'where':{'id':_0x10fe33[_0x01f8('0x46')]['id']}})[_0x01f8('0x28')](handleEntityNotFound(_0x4851b5,null))['then'](removeEntity(_0x4851b5,null))[_0x01f8('0x44')](handleError(_0x4851b5,null));};exports['create']=function(_0x474f75,_0x4d7b1b,_0x692ef3){_0x474f75[_0x01f8('0x51')][_0x01f8('0x2b')]=_0x474f75[_0x01f8('0x53')]['originalname'];_0x474f75[_0x01f8('0x51')][_0x01f8('0x54')]=_0x474f75[_0x01f8('0x53')][_0x01f8('0x55')];_0x474f75[_0x01f8('0x51')][_0x01f8('0x56')]=_0x474f75[_0x01f8('0x53')][_0x01f8('0x57')];return db[_0x01f8('0x2f')][_0x01f8('0x58')](_0x474f75['body'])[_0x01f8('0x28')](respondWithResult(_0x4d7b1b,0xc9))[_0x01f8('0x44')](handleError(_0x4d7b1b,null));};exports[_0x01f8('0x59')]=function(_0x2cc4a0,_0x3aa631,_0x5c68b1){return db[_0x01f8('0x2f')][_0x01f8('0x5a')]({'where':{'id':_0x2cc4a0['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3aa631,null))[_0x01f8('0x28')](function(_0x5d2700){if(_0x5d2700){return _0x3aa631[_0x01f8('0x59')](path['join'](config[_0x01f8('0x5b')],_0x01f8('0x5c'),_0x5d2700[_0x01f8('0x54')]));}})[_0x01f8('0x44')](handleError(_0x3aa631,null));};
\ No newline at end of file
+var _0x4bbc=['../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','then','end','error','stack','name','index','Attachment','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','options','include','findAll','rows','catch','show','rawAttributes','find','params','length','omit','createdAt','updatedAt','body','create','includeAll','update','originalname','basename','file','filename','mimetype','download','findOne','ChatOfflineMessageId','join','eml-format','rimraf','zip-dir','fast-json-patch','util','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3cb09b,_0x31c2a5){var _0x242048=function(_0x464aba){while(--_0x464aba){_0x3cb09b['push'](_0x3cb09b['shift']());}};_0x242048(++_0x31c2a5);}(_0x4bbc,0x1d3));var _0xc4bb=function(_0x64e71,_0x4c3b57){_0x64e71=_0x64e71-0x0;var _0x10c5c1=_0x4bbc[_0x64e71];return _0x10c5c1;};'use strict';var emlformat=require(_0xc4bb('0x0'));var rimraf=require(_0xc4bb('0x1'));var zipdir=require(_0xc4bb('0x2'));var jsonpatch=require(_0xc4bb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc4bb('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xc4bb('0x5'));var ejs=require(_0xc4bb('0x6'));var fs=require('fs');var fs_extra=require(_0xc4bb('0x7'));var _=require(_0xc4bb('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc4bb('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xc4bb('0x5'));var querystring=require(_0xc4bb('0xa'));var Papa=require('papaparse');var Redis=require(_0xc4bb('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xc4bb('0xc'));var as=require(_0xc4bb('0xd'));var hardwareService=require(_0xc4bb('0xe'));var logger=require('../../config/logger')(_0xc4bb('0xf'));var utils=require(_0xc4bb('0x10'));var config=require(_0xc4bb('0x11'));var licenseUtil=require(_0xc4bb('0x12'));var db=require(_0xc4bb('0x13'))['db'];function respondWithStatusCode(_0x25f656,_0x2c76c3){_0x2c76c3=_0x2c76c3||0xcc;return function(_0x156571){if(_0x156571){return _0x25f656['sendStatus'](_0x2c76c3);}return _0x25f656[_0xc4bb('0x14')](_0x2c76c3)['end']();};}function respondWithResult(_0x55e3bd,_0x23de12){_0x23de12=_0x23de12||0xc8;return function(_0x198cf0){if(_0x198cf0){return _0x55e3bd[_0xc4bb('0x14')](_0x23de12)[_0xc4bb('0x15')](_0x198cf0);}};}function respondWithFilteredResult(_0x3d330c,_0x2707f9){return function(_0x29f9f0){if(_0x29f9f0){var _0x560ba2=typeof _0x2707f9['offset']===_0xc4bb('0x16')&&typeof _0x2707f9[_0xc4bb('0x17')]==='undefined';var _0x403fd3=_0x29f9f0[_0xc4bb('0x18')];var _0x362d5f=_0x560ba2?0x0:_0x2707f9['offset'];var _0x3e4399=_0x560ba2?_0x29f9f0[_0xc4bb('0x18')]:_0x2707f9[_0xc4bb('0x19')]+_0x2707f9[_0xc4bb('0x17')];var _0x35ff9e;if(_0x3e4399>=_0x403fd3){_0x3e4399=_0x403fd3;_0x35ff9e=0xc8;}else{_0x35ff9e=0xce;}_0x3d330c[_0xc4bb('0x14')](_0x35ff9e);return _0x3d330c[_0xc4bb('0x1a')](_0xc4bb('0x1b'),_0x362d5f+'-'+_0x3e4399+'/'+_0x403fd3)['json'](_0x29f9f0);}return null;};}function patchUpdates(_0x4c65c3){return function(_0x2211e6){try{jsonpatch[_0xc4bb('0x1c')](_0x2211e6,_0x4c65c3,!![]);}catch(_0x55a036){return BPromise[_0xc4bb('0x1d')](_0x55a036);}return _0x2211e6['save']();};}function saveUpdates(_0x23c7f4,_0x54233e){return function(_0x191b7e){if(_0x191b7e){return _0x191b7e['update'](_0x23c7f4)['then'](function(_0x9a2d8b){return _0x9a2d8b;});}return null;};}function removeEntity(_0x5be895,_0x4bfff4){return function(_0x3c99fe){if(_0x3c99fe){return _0x3c99fe[_0xc4bb('0x1e')]()[_0xc4bb('0x1f')](function(){_0x5be895[_0xc4bb('0x14')](0xcc)[_0xc4bb('0x20')]();});}};}function handleEntityNotFound(_0x74fe6d,_0x5aa8a6){return function(_0x2be45e){if(!_0x2be45e){_0x74fe6d['sendStatus'](0x194);}return _0x2be45e;};}function handleError(_0x1ed7d2,_0x409de9){_0x409de9=_0x409de9||0x1f4;return function(_0x1d251a){logger[_0xc4bb('0x21')](_0x1d251a[_0xc4bb('0x22')]);if(_0x1d251a[_0xc4bb('0x23')]){delete _0x1d251a['name'];}_0x1ed7d2[_0xc4bb('0x14')](_0x409de9)['send'](_0x1d251a);};}exports[_0xc4bb('0x24')]=function(_0x21c649,_0x4530c2){var _0x39e9b9={},_0x37ca25={},_0x23e538={'count':0x0,'rows':[]};var _0x592a50=_['map'](db[_0xc4bb('0x25')]['rawAttributes'],function(_0x32b89e){return{'name':_0x32b89e[_0xc4bb('0x26')],'type':_0x32b89e[_0xc4bb('0x27')][_0xc4bb('0x28')]};});_0x37ca25[_0xc4bb('0x29')]=_[_0xc4bb('0x2a')](_0x592a50,'name');_0x37ca25['query']=_[_0xc4bb('0x2b')](_0x21c649[_0xc4bb('0x2c')]);_0x37ca25[_0xc4bb('0x2d')]=_[_0xc4bb('0x2e')](_0x37ca25[_0xc4bb('0x29')],_0x37ca25[_0xc4bb('0x2c')]);_0x39e9b9[_0xc4bb('0x2f')]=_[_0xc4bb('0x2e')](_0x37ca25[_0xc4bb('0x29')],qs[_0xc4bb('0x30')](_0x21c649['query'][_0xc4bb('0x30')]));_0x39e9b9[_0xc4bb('0x2f')]=_0x39e9b9[_0xc4bb('0x2f')]['length']?_0x39e9b9[_0xc4bb('0x2f')]:_0x37ca25[_0xc4bb('0x29')];if(!_0x21c649[_0xc4bb('0x2c')][_0xc4bb('0x31')]('nolimit')){_0x39e9b9['limit']=qs['limit'](_0x21c649[_0xc4bb('0x2c')]['limit']);_0x39e9b9['offset']=qs[_0xc4bb('0x19')](_0x21c649['query'][_0xc4bb('0x19')]);}_0x39e9b9[_0xc4bb('0x32')]=qs[_0xc4bb('0x33')](_0x21c649[_0xc4bb('0x2c')][_0xc4bb('0x33')]);_0x39e9b9['where']=qs['filters'](_[_0xc4bb('0x34')](_0x21c649['query'],_0x37ca25[_0xc4bb('0x2d')]),_0x592a50);if(_0x21c649[_0xc4bb('0x2c')]['filter']){_0x39e9b9[_0xc4bb('0x35')]=_[_0xc4bb('0x36')](_0x39e9b9[_0xc4bb('0x35')],{'$or':_['map'](_0x592a50,function(_0xb69d56){if(_0xb69d56[_0xc4bb('0x27')]!=='VIRTUAL'){var _0x526bc8={};_0x526bc8[_0xb69d56['name']]={'$like':'%'+_0x21c649[_0xc4bb('0x2c')]['filter']+'%'};return _0x526bc8;}})});}_0x39e9b9=_[_0xc4bb('0x36')]({},_0x39e9b9,_0x21c649[_0xc4bb('0x37')]);var _0x28ffcb={'where':_0x39e9b9[_0xc4bb('0x35')]};return db[_0xc4bb('0x25')][_0xc4bb('0x18')](_0x28ffcb)['then'](function(_0x56533f){_0x23e538['count']=_0x56533f;if(_0x21c649['query']['includeAll']){_0x39e9b9[_0xc4bb('0x38')]=[{'all':!![]}];}return db[_0xc4bb('0x25')][_0xc4bb('0x39')](_0x39e9b9);})['then'](function(_0x8766dd){_0x23e538[_0xc4bb('0x3a')]=_0x8766dd;return _0x23e538;})[_0xc4bb('0x1f')](respondWithFilteredResult(_0x4530c2,_0x39e9b9))[_0xc4bb('0x3b')](handleError(_0x4530c2,null));};exports[_0xc4bb('0x3c')]=function(_0x30de98,_0x31bc3b){var _0x6144d8={'raw':!![],'where':{'id':_0x30de98['params']['id']}},_0x33248f={};_0x33248f['model']=_[_0xc4bb('0x2b')](db['Attachment'][_0xc4bb('0x3d')]);_0x33248f[_0xc4bb('0x2c')]=_[_0xc4bb('0x2b')](_0x30de98[_0xc4bb('0x2c')]);_0x33248f['filters']=_[_0xc4bb('0x2e')](_0x33248f['model'],_0x33248f[_0xc4bb('0x2c')]);_0x6144d8[_0xc4bb('0x2f')]=_[_0xc4bb('0x2e')](_0x33248f[_0xc4bb('0x29')],qs[_0xc4bb('0x30')](_0x30de98[_0xc4bb('0x2c')][_0xc4bb('0x30')]));_0x6144d8['attributes']=_0x6144d8[_0xc4bb('0x2f')]['length']?_0x6144d8[_0xc4bb('0x2f')]:_0x33248f[_0xc4bb('0x29')];if(_0x30de98[_0xc4bb('0x2c')]['includeAll']){_0x6144d8['include']=[{'all':!![]}];}_0x6144d8=_[_0xc4bb('0x36')]({},_0x6144d8,_0x30de98[_0xc4bb('0x37')]);return db[_0xc4bb('0x25')][_0xc4bb('0x3e')](_0x6144d8)[_0xc4bb('0x1f')](handleEntityNotFound(_0x31bc3b,null))[_0xc4bb('0x1f')](respondWithResult(_0x31bc3b,null))['catch'](handleError(_0x31bc3b,null));};exports['clone']=function(_0x15c614,_0x15e83c){var _0x53b2fe={'where':{'id':_0x15c614[_0xc4bb('0x3f')]['id']}},_0x18adba={};_0x18adba[_0xc4bb('0x29')]=_[_0xc4bb('0x2b')](db[_0xc4bb('0x25')]['rawAttributes']);_0x53b2fe[_0xc4bb('0x2f')]=_[_0xc4bb('0x2e')](_0x18adba[_0xc4bb('0x29')],qs[_0xc4bb('0x30')](_0x15c614[_0xc4bb('0x2c')]['fields']));_0x53b2fe['attributes']=_0x53b2fe[_0xc4bb('0x2f')][_0xc4bb('0x40')]?_0x53b2fe[_0xc4bb('0x2f')]:_0x18adba[_0xc4bb('0x29')];if(_0x15c614[_0xc4bb('0x2c')]['includeAll']){_0x53b2fe['include']=[{'all':!![]}];}_0x53b2fe=_[_0xc4bb('0x36')]({},_0x53b2fe,_0x15c614['options']);return db['Attachment']['find'](_0x53b2fe)[_0xc4bb('0x1f')](handleEntityNotFound(_0x15e83c,null))[_0xc4bb('0x1f')](function(_0x482b45){if(_0x482b45){var _0x492b0e=_0x482b45['get']({'plain':!![]});_0x492b0e=qs[_0xc4bb('0x41')](_0x492b0e,['id',_0xc4bb('0x42'),_0xc4bb('0x43')]);_0x15c614['body']=_[_0xc4bb('0x41')](_0x15c614[_0xc4bb('0x44')],['id',_0xc4bb('0x42'),_0xc4bb('0x43')]);return db[_0xc4bb('0x25')][_0xc4bb('0x45')](_[_0xc4bb('0x36')](_0x492b0e,_0x15c614[_0xc4bb('0x44')]),{'include':_0x15c614[_0xc4bb('0x2c')][_0xc4bb('0x46')]?[{'all':!![]}]:undefined});}})[_0xc4bb('0x1f')](respondWithResult(_0x15e83c,0xc9))[_0xc4bb('0x3b')](handleError(_0x15e83c,null));};exports[_0xc4bb('0x47')]=function(_0x186637,_0x5a912e){if(_0x186637['body']['id']){delete _0x186637[_0xc4bb('0x44')]['id'];}return db[_0xc4bb('0x25')]['find']({'where':{'id':_0x186637[_0xc4bb('0x3f')]['id']}})[_0xc4bb('0x1f')](handleEntityNotFound(_0x5a912e,null))[_0xc4bb('0x1f')](saveUpdates(_0x186637[_0xc4bb('0x44')],null))['then'](respondWithResult(_0x5a912e,null))[_0xc4bb('0x3b')](handleError(_0x5a912e,null));};exports[_0xc4bb('0x1e')]=function(_0x474285,_0x331c06){return db[_0xc4bb('0x25')][_0xc4bb('0x3e')]({'where':{'id':_0x474285[_0xc4bb('0x3f')]['id']}})[_0xc4bb('0x1f')](handleEntityNotFound(_0x331c06,null))[_0xc4bb('0x1f')](removeEntity(_0x331c06,null))[_0xc4bb('0x3b')](handleError(_0x331c06,null));};exports['create']=function(_0xa5307,_0x481dc6,_0x3db9a4){_0xa5307[_0xc4bb('0x44')][_0xc4bb('0x23')]=_0xa5307['file'][_0xc4bb('0x48')];_0xa5307[_0xc4bb('0x44')][_0xc4bb('0x49')]=_0xa5307[_0xc4bb('0x4a')][_0xc4bb('0x4b')];_0xa5307['body'][_0xc4bb('0x27')]=_0xa5307[_0xc4bb('0x4a')][_0xc4bb('0x4c')];return db[_0xc4bb('0x25')][_0xc4bb('0x45')](_0xa5307[_0xc4bb('0x44')])[_0xc4bb('0x1f')](respondWithResult(_0x481dc6,0xc9))[_0xc4bb('0x3b')](handleError(_0x481dc6,null));};exports[_0xc4bb('0x4d')]=function(_0x5b0947,_0x1b9440,_0x512c53){return db[_0xc4bb('0x25')][_0xc4bb('0x4e')]({'where':{'id':_0x5b0947[_0xc4bb('0x3f')]['id']},'raw':!![]})[_0xc4bb('0x1f')](handleEntityNotFound(_0x1b9440,null))[_0xc4bb('0x1f')](function(_0x41afa4){if(_0x41afa4){var _0x475916=_0x41afa4[_0xc4bb('0x4f')]!==null;var _0x1c0bed=path[_0xc4bb('0x50')](config['root'],'server/files/attachments/');if(_0x475916){_0x1c0bed=path['join'](_0x1c0bed,'offline-chat/');}var _0x47d66d=path[_0xc4bb('0x50')](_0x1c0bed,_0x41afa4[_0xc4bb('0x49')]);return _0x1b9440[_0xc4bb('0x4d')](_0x47d66d);}})[_0xc4bb('0x3b')](handleError(_0x1b9440,null));};
\ No newline at end of file