Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / faxMessage / faxMessage.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x9f06=['hasOwnProperty','nolimit','order','sort','where','filter','options','FaxMessage','count','include','findAll','rows','show','params','intersection','includeAll','find','catch','../../config/logger','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','FaxInteractionId','isNil','read1stAt','get','user','role','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','interface','create','CmContact','findOne','ContactId','Attachment','AttachmentId','FaxAccountId','basename','download','join','server','files','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','destroy','stack','name','render','merge','body','contact','agent','interaction','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length'];(function(_0x2f5d1f,_0x242bca){var _0x1f21f4=function(_0x2f329f){while(--_0x2f329f){_0x2f5d1f['push'](_0x2f5d1f['shift']());}};_0x1f21f4(++_0x242bca);}(_0x9f06,0x13a));var _0x69f0=function(_0x2e3600,_0x556215){_0x2e3600=_0x2e3600-0x0;var _0x2e46bd=_0x9f06[_0x2e3600];return _0x2e46bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x69f0('0x0'));var jsonpatch=require(_0x69f0('0x1'));var rp=require(_0x69f0('0x2'));var moment=require(_0x69f0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x69f0('0x4'));var path=require(_0x69f0('0x5'));var sox=require(_0x69f0('0x6'));var csv=require(_0x69f0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x69f0('0x8'));var _=require('lodash');var squel=require(_0x69f0('0x9'));var crypto=require(_0x69f0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x69f0('0xb'));var toCsv=require(_0x69f0('0x7'));var querystring=require(_0x69f0('0xc'));var Papa=require(_0x69f0('0xd'));var Redis=require(_0x69f0('0xe'));var authService=require(_0x69f0('0xf'));var qs=require(_0x69f0('0x10'));var as=require(_0x69f0('0x11'));var hardwareService=require(_0x69f0('0x12'));var logger=require('../../config/logger')(_0x69f0('0x13'));var utils=require(_0x69f0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x69f0('0x15'));var db=require(_0x69f0('0x16'))['db'];config[_0x69f0('0x17')]=_['defaults'](config[_0x69f0('0x17')],{'host':_0x69f0('0x18'),'port':0x18eb});var socket=require(_0x69f0('0x19'))(new Redis(config[_0x69f0('0x17')]));require('./faxMessage.socket')[_0x69f0('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x69f0('0x1b')][_0x69f0('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x69f0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x582747,_0x52383d,_0x553d3b,_0x546323){return new BPromise(function(_0x11dc8e,_0x5e71c8){var _0x38d0e4=_0x546323||client;return _0x38d0e4[_0x69f0('0x1d')](_0x582747,_0x553d3b)[_0x69f0('0x1e')](function(_0x301386){logger[_0x69f0('0x1f')](_0x69f0('0x20'),_0x52383d,_0x69f0('0x21'));logger[_0x69f0('0x22')](_0x69f0('0x23'),_0x52383d,_0x69f0('0x21'),JSON[_0x69f0('0x24')](_0x301386));if(_0x301386[_0x69f0('0x25')]){if(_0x301386['error']['code']===0x1f4){logger[_0x69f0('0x25')](_0x69f0('0x20'),_0x52383d,_0x301386[_0x69f0('0x25')][_0x69f0('0x26')]);return _0x5e71c8(_0x301386[_0x69f0('0x25')]['message']);}logger[_0x69f0('0x25')]('FaxMessage,\x20%s,\x20%s',_0x52383d,_0x301386['error']['message']);return _0x11dc8e(_0x301386['error'][_0x69f0('0x26')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x52383d,_0x69f0('0x21'));_0x11dc8e(_0x301386[_0x69f0('0x27')][_0x69f0('0x26')]);}})['catch'](function(_0x178a31){logger[_0x69f0('0x25')](_0x69f0('0x20'),_0x52383d,_0x178a31);_0x5e71c8(_0x178a31);});});}function respondWithStatusCode(_0x14139b,_0x5190a2){_0x5190a2=_0x5190a2||0xcc;return function(_0x23e641){if(_0x23e641){return _0x14139b[_0x69f0('0x28')](_0x5190a2);}return _0x14139b[_0x69f0('0x29')](_0x5190a2)[_0x69f0('0x2a')]();};}function respondWithResult(_0x565fd2,_0x29b5ea){_0x29b5ea=_0x29b5ea||0xc8;return function(_0x2338ec){if(_0x2338ec){return _0x565fd2[_0x69f0('0x29')](_0x29b5ea)[_0x69f0('0x2b')](_0x2338ec);}};}function respondWithFilteredResult(_0x113d9b,_0x26d5ac){return function(_0xb6b69e){if(_0xb6b69e){var _0x233025=typeof _0x26d5ac[_0x69f0('0x2c')]==='undefined'&&typeof _0x26d5ac['limit']===_0x69f0('0x2d');var _0x2bdbe4=_0xb6b69e['count'];var _0x1d9bd3=_0x233025?0x0:_0x26d5ac[_0x69f0('0x2c')];var _0x3a3e5d=_0x233025?_0xb6b69e['count']:_0x26d5ac[_0x69f0('0x2c')]+_0x26d5ac[_0x69f0('0x2e')];var _0x1c7af3;if(_0x3a3e5d>=_0x2bdbe4){_0x3a3e5d=_0x2bdbe4;_0x1c7af3=0xc8;}else{_0x1c7af3=0xce;}_0x113d9b['status'](_0x1c7af3);return _0x113d9b[_0x69f0('0x2f')](_0x69f0('0x30'),_0x1d9bd3+'-'+_0x3a3e5d+'/'+_0x2bdbe4)[_0x69f0('0x2b')](_0xb6b69e);}return null;};}function patchUpdates(_0x494a03){return function(_0x2787cf){try{jsonpatch['apply'](_0x2787cf,_0x494a03,!![]);}catch(_0x15b4bb){return BPromise['reject'](_0x15b4bb);}return _0x2787cf[_0x69f0('0x31')]();};}function saveUpdates(_0x223e4f,_0x309db1){return function(_0x48f4e9){if(_0x48f4e9){return _0x48f4e9['update'](_0x223e4f)[_0x69f0('0x1e')](function(_0x31d69e){return _0x31d69e;});}return null;};}function removeEntity(_0xd7a361,_0x5759bc){return function(_0x356f23){if(_0x356f23){return _0x356f23[_0x69f0('0x32')]()[_0x69f0('0x1e')](function(){_0xd7a361[_0x69f0('0x29')](0xcc)[_0x69f0('0x2a')]();});}};}function handleEntityNotFound(_0x4f2521,_0x55aa38){return function(_0x5ee19b){if(!_0x5ee19b){_0x4f2521[_0x69f0('0x28')](0x194);}return _0x5ee19b;};}function handleError(_0x42beb0,_0x193eef){_0x193eef=_0x193eef||0x1f4;return function(_0x2d1518){logger[_0x69f0('0x25')](_0x2d1518[_0x69f0('0x33')]);if(_0x2d1518[_0x69f0('0x34')]){delete _0x2d1518[_0x69f0('0x34')];}_0x42beb0[_0x69f0('0x29')](_0x193eef)['send'](_0x2d1518);};}function getMustacheRender(_0x9a4b9e,_0xee48f4){return Mustache[_0x69f0('0x35')](_0x9a4b9e,_[_0x69f0('0x36')](_0xee48f4[_0x69f0('0x37')],{'contact':_0xee48f4[_0x69f0('0x38')],'message':_0xee48f4['message'],'agent':_0xee48f4[_0x69f0('0x39')],'interaction':_0xee48f4[_0x69f0('0x3a')],'account':_0xee48f4['account']}))||'';}exports['index']=function(_0x3eff8e,_0x2702a3){var _0x55f2d7={},_0x456a8d={},_0x6be8da={'count':0x0,'rows':[]};var _0x30b559=_[_0x69f0('0x3b')](db['FaxMessage'][_0x69f0('0x3c')],function(_0x27da5c){return{'name':_0x27da5c[_0x69f0('0x3d')],'type':_0x27da5c[_0x69f0('0x3e')]['key']};});_0x456a8d[_0x69f0('0x3f')]=_[_0x69f0('0x3b')](_0x30b559,_0x69f0('0x34'));_0x456a8d[_0x69f0('0x40')]=_[_0x69f0('0x41')](_0x3eff8e['query']);_0x456a8d[_0x69f0('0x42')]=_['intersection'](_0x456a8d[_0x69f0('0x3f')],_0x456a8d['query']);_0x55f2d7[_0x69f0('0x43')]=_['intersection'](_0x456a8d[_0x69f0('0x3f')],qs[_0x69f0('0x44')](_0x3eff8e[_0x69f0('0x40')][_0x69f0('0x44')]));_0x55f2d7[_0x69f0('0x43')]=_0x55f2d7['attributes'][_0x69f0('0x45')]?_0x55f2d7['attributes']:_0x456a8d[_0x69f0('0x3f')];if(!_0x3eff8e[_0x69f0('0x40')][_0x69f0('0x46')](_0x69f0('0x47'))){_0x55f2d7[_0x69f0('0x2e')]=qs[_0x69f0('0x2e')](_0x3eff8e[_0x69f0('0x40')][_0x69f0('0x2e')]);_0x55f2d7['offset']=qs['offset'](_0x3eff8e[_0x69f0('0x40')]['offset']);}_0x55f2d7[_0x69f0('0x48')]=qs['sort'](_0x3eff8e[_0x69f0('0x40')][_0x69f0('0x49')]);_0x55f2d7[_0x69f0('0x4a')]=qs[_0x69f0('0x42')](_['pick'](_0x3eff8e[_0x69f0('0x40')],_0x456a8d[_0x69f0('0x42')]),_0x30b559);if(_0x3eff8e['query'][_0x69f0('0x4b')]){_0x55f2d7[_0x69f0('0x4a')]=_[_0x69f0('0x36')](_0x55f2d7[_0x69f0('0x4a')],{'$or':_['map'](_0x30b559,function(_0x3208ec){if(_0x3208ec['type']!=='VIRTUAL'){var _0x48885c={};_0x48885c[_0x3208ec[_0x69f0('0x34')]]={'$like':'%'+_0x3eff8e[_0x69f0('0x40')]['filter']+'%'};return _0x48885c;}})});}_0x55f2d7=_[_0x69f0('0x36')]({},_0x55f2d7,_0x3eff8e[_0x69f0('0x4c')]);var _0x45defc={'where':_0x55f2d7[_0x69f0('0x4a')]};return db[_0x69f0('0x4d')][_0x69f0('0x4e')](_0x45defc)[_0x69f0('0x1e')](function(_0x1c8bd2){_0x6be8da['count']=_0x1c8bd2;if(_0x3eff8e[_0x69f0('0x40')]['includeAll']){_0x55f2d7[_0x69f0('0x4f')]=[{'all':!![]}];}return db[_0x69f0('0x4d')][_0x69f0('0x50')](_0x55f2d7);})[_0x69f0('0x1e')](function(_0x24875c){_0x6be8da[_0x69f0('0x51')]=_0x24875c;return _0x6be8da;})['then'](respondWithFilteredResult(_0x2702a3,_0x55f2d7))['catch'](handleError(_0x2702a3,null));};exports[_0x69f0('0x52')]=function(_0x11d642,_0x17d7bd){var _0x58e472={'raw':!![],'where':{'id':_0x11d642[_0x69f0('0x53')]['id']}},_0x2cfd5d={};_0x2cfd5d[_0x69f0('0x3f')]=_[_0x69f0('0x41')](db[_0x69f0('0x4d')]['rawAttributes']);_0x2cfd5d[_0x69f0('0x40')]=_[_0x69f0('0x41')](_0x11d642['query']);_0x2cfd5d[_0x69f0('0x42')]=_[_0x69f0('0x54')](_0x2cfd5d[_0x69f0('0x3f')],_0x2cfd5d['query']);_0x58e472[_0x69f0('0x43')]=_['intersection'](_0x2cfd5d[_0x69f0('0x3f')],qs['fields'](_0x11d642[_0x69f0('0x40')][_0x69f0('0x44')]));_0x58e472[_0x69f0('0x43')]=_0x58e472['attributes'][_0x69f0('0x45')]?_0x58e472[_0x69f0('0x43')]:_0x2cfd5d[_0x69f0('0x3f')];if(_0x11d642['query'][_0x69f0('0x55')]){_0x58e472[_0x69f0('0x4f')]=[{'all':!![]}];}_0x58e472=_[_0x69f0('0x36')]({},_0x58e472,_0x11d642[_0x69f0('0x4c')]);return db[_0x69f0('0x4d')][_0x69f0('0x56')](_0x58e472)['then'](handleEntityNotFound(_0x17d7bd,null))[_0x69f0('0x1e')](respondWithResult(_0x17d7bd,null))['catch'](handleError(_0x17d7bd,null));};exports['update']=function(_0x4d0900,_0xfd93f6){if(_0x4d0900[_0x69f0('0x37')]['id']){delete _0x4d0900[_0x69f0('0x37')]['id'];}return db[_0x69f0('0x4d')]['find']({'where':{'id':_0x4d0900[_0x69f0('0x53')]['id']}})[_0x69f0('0x1e')](handleEntityNotFound(_0xfd93f6,null))[_0x69f0('0x1e')](saveUpdates(_0x4d0900['body'],null))['then'](respondWithResult(_0xfd93f6,null))[_0x69f0('0x57')](handleError(_0xfd93f6,null));};exports[_0x69f0('0x32')]=function(_0x5afc49,_0x4bf3b8){return db[_0x69f0('0x4d')][_0x69f0('0x56')]({'where':{'id':_0x5afc49['params']['id']}})[_0x69f0('0x1e')](handleEntityNotFound(_0x4bf3b8,null))['then'](removeEntity(_0x4bf3b8,null))[_0x69f0('0x57')](handleError(_0x4bf3b8,null));};exports['describe']=function(_0x3eb54f,_0x155439){return db[_0x69f0('0x4d')]['describe']()['then'](respondWithResult(_0x155439,null))[_0x69f0('0x57')](handleError(_0x155439,null));};var interaction_log=require(_0x69f0('0x58'))(_0x69f0('0x59'));exports[_0x69f0('0x5a')]=function(_0x64f567,_0x22700a,_0x5b1aa6){var _0x231b88={'agent':{},'channel':'fax'};if(_0x64f567['body']['id']){delete _0x64f567[_0x69f0('0x37')]['id'];}_0x64f567[_0x69f0('0x37')]['read']=!![];_0x64f567['body'][_0x69f0('0x5b')]=moment()[_0x69f0('0x5c')](_0x69f0('0x5d'));_0x64f567[_0x69f0('0x37')][_0x69f0('0x5e')]=_0x64f567[_0x69f0('0x37')][_0x69f0('0x5e')]||_0x64f567['user']['id'];_0x231b88['agent']['id']=_0x64f567[_0x69f0('0x37')][_0x69f0('0x5e')];return db[_0x69f0('0x4d')][_0x69f0('0x56')]({'where':{'id':_0x64f567['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x69f0('0x1e')](handleEntityNotFound(_0x22700a,null))['then'](saveUpdates(_0x64f567[_0x69f0('0x37')],null))[_0x69f0('0x1e')](function(_0x4fc421){if(_0x4fc421){_0x231b88[_0x69f0('0x26')]=_0x4fc421['get']({'plain':!![]});return db['FaxInteraction'][_0x69f0('0x56')]({'where':{'id':_0x4fc421[_0x69f0('0x5f')]}});}return null;})[_0x69f0('0x1e')](handleEntityNotFound(_0x22700a,null))['then'](function(_0x46c79e){if(_0x46c79e){return _0x46c79e['update']({'UserId':_0x64f567['body']['UserId'],'read1stAt':_[_0x69f0('0x60')](_0x46c79e[_0x69f0('0x61')])?moment()[_0x69f0('0x5c')](_0x69f0('0x5d')):undefined});}return null;})[_0x69f0('0x1e')](function(_0x26bd1f){if(_0x26bd1f){_0x231b88[_0x69f0('0x3a')]=_0x26bd1f[_0x69f0('0x62')]({'plain':!![]});interaction_log[_0x69f0('0x1f')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x64f567[_0x69f0('0x63')]['id'],_0x64f567[_0x69f0('0x63')][_0x69f0('0x34')],_0x64f567[_0x69f0('0x63')][_0x69f0('0x64')],_0x231b88['interaction']['id'],_0x64f567['body']?JSON[_0x69f0('0x24')](_0x64f567[_0x69f0('0x37')]):'null');return respondWithRpcPromise(_0x69f0('0x65'),_0x69f0('0x66'),_0x231b88);}return null;})[_0x69f0('0x1e')](function(_0x566c94){if(_0x566c94){if(_0x64f567[_0x69f0('0x37')][_0x69f0('0x67')]){_0x231b88[_0x69f0('0x26')]['interface']=util[_0x69f0('0x5c')](_0x69f0('0x68'),_0x64f567['user'][_0x69f0('0x34')]);_0x231b88[_0x69f0('0x26')]['channel']=_0x231b88[_0x69f0('0x69')];_0x231b88[_0x69f0('0x26')][_0x69f0('0x6a')]='accept';return respondWithRpcPromise('EventManager',_0x69f0('0x6b'),{'event':_0x69f0('0x6c'),'message':_0x231b88['message']},client9002)[_0x69f0('0x1e')](function(){return _0x231b88;});}return _0x231b88;}return null;})['then'](respondWithResult(_0x22700a,null))[_0x69f0('0x57')](handleError(_0x22700a,null));};var interaction_log=require(_0x69f0('0x58'))(_0x69f0('0x59'));exports[_0x69f0('0x6d')]=function(_0x41088a,_0x567d99,_0x2f3862){var _0x19ea92={'agent':{},'channel':_0x69f0('0x6e')};if(_0x41088a[_0x69f0('0x37')]['id']){delete _0x41088a[_0x69f0('0x37')]['id'];}_0x41088a[_0x69f0('0x37')]['UserId']=_0x41088a['body'][_0x69f0('0x5e')]||_0x41088a[_0x69f0('0x63')]['id'];_0x19ea92[_0x69f0('0x39')]['id']=_0x41088a[_0x69f0('0x37')][_0x69f0('0x5e')];return db[_0x69f0('0x4d')][_0x69f0('0x56')]({'where':{'id':_0x41088a[_0x69f0('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x567d99,null))[_0x69f0('0x1e')](function(_0x23023d){if(_0x23023d){_0x19ea92[_0x69f0('0x26')]=_0x23023d[_0x69f0('0x62')]({'plain':!![]});return db[_0x69f0('0x6f')][_0x69f0('0x56')]({'where':{'id':_0x23023d[_0x69f0('0x5f')]}});}return null;})[_0x69f0('0x1e')](handleEntityNotFound(_0x567d99,null))[_0x69f0('0x1e')](function(_0x2e6207){if(_0x2e6207){_0x19ea92['interaction']=_0x2e6207[_0x69f0('0x62')]({'plain':!![]});interaction_log['info'](_0x69f0('0x70'),_0x41088a[_0x69f0('0x63')]['id'],_0x41088a[_0x69f0('0x63')][_0x69f0('0x34')],_0x41088a['user']['role'],_0x19ea92[_0x69f0('0x3a')]['id'],_0x41088a['body']?JSON[_0x69f0('0x24')](_0x41088a[_0x69f0('0x37')]):_0x69f0('0x71'));return respondWithRpcPromise('RejectMessage',_0x69f0('0x72'),_0x19ea92);}return null;})[_0x69f0('0x1e')](function(_0x3953f6){if(_0x3953f6){_0x3953f6['message'][_0x69f0('0x73')]=util[_0x69f0('0x5c')](_0x69f0('0x68'),_0x41088a[_0x69f0('0x63')][_0x69f0('0x34')]);_0x3953f6[_0x69f0('0x26')][_0x69f0('0x69')]=_0x19ea92[_0x69f0('0x69')];_0x3953f6[_0x69f0('0x26')][_0x69f0('0x6a')]=_0x69f0('0x6d');respondWithRpcPromise(_0x69f0('0x6b'),_0x69f0('0x6b'),{'event':'rejectmessage','message':_0x3953f6[_0x69f0('0x26')]},client9002);return _0x19ea92;}return null;})[_0x69f0('0x1e')](respondWithResult(_0x567d99,null))[_0x69f0('0x57')](handleError(_0x567d99,null));};exports[_0x69f0('0x74')]=function(_0x118aea,_0x35381d){var _0xf1d697;return db[_0x69f0('0x4d')][_0x69f0('0x74')](_0x118aea[_0x69f0('0x37')],{})[_0x69f0('0x1e')](function(_0xa50546){_0xf1d697=_0xa50546;return db[_0x69f0('0x75')][_0x69f0('0x76')]({'where':{'id':_0xf1d697[_0x69f0('0x77')]}});})[_0x69f0('0x1e')](function(_0x5406ff){if(_[_0x69f0('0x60')](_0x5406ff)){return;}else{_0xf1d697[_0x69f0('0x6e')]=_0x5406ff['fax'];return db[_0x69f0('0x78')][_0x69f0('0x76')]({'where':{'id':_0xf1d697[_0x69f0('0x79')]}});}})[_0x69f0('0x1e')](function(_0x5add1c){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x118aea[_0x69f0('0x37')])?undefined:_0x118aea[_0x69f0('0x37')][_0x69f0('0x7a')],'path':_[_0x69f0('0x60')](_0x5add1c)?undefined:util[_0x69f0('0x5c')]('/var/opt/motion2/server/files/attachments/%s',_0x5add1c[_0x69f0('0x7b')]),'fax':_[_0x69f0('0x60')](_0xf1d697[_0x69f0('0x6e')])?undefined:_0xf1d697['fax'],'AttachmentId':_0xf1d697[_0x69f0('0x79')]},client9002);})[_0x69f0('0x1e')](respondWithResult(_0x35381d,0xc9))[_0x69f0('0x57')](handleError(_0x35381d,null));};exports[_0x69f0('0x7c')]=function(_0x4c3880,_0x551c32){var _0x3ad1a5=path[_0x69f0('0x7d')](config['root'],_0x69f0('0x7e'),_0x69f0('0x7f'),'attachments');return db[_0x69f0('0x4d')][_0x69f0('0x56')]({'where':{'id':_0x4c3880[_0x69f0('0x53')]['id']},'include':[{'model':db[_0x69f0('0x78')],'as':_0x69f0('0x78')}]})[_0x69f0('0x1e')](handleEntityNotFound(_0x551c32,null))[_0x69f0('0x1e')](function(_0x10e86a){if(_0x10e86a){return _0x551c32[_0x69f0('0x7c')](path[_0x69f0('0x7d')](_0x3ad1a5,_0x10e86a[_0x69f0('0x78')]['basename']));}})[_0x69f0('0x57')](handleError(_0x551c32,null));};