Built motion from commit 47436d59.|2.6.7
[motion2.git] / server / api / cannedAnswer / cannedAnswer.controller.js
index aed6b4e..96c37ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4d64=['destroy','then','get','CannedAnswers','UserProfileResource','end','error','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','keys','includeAll','find','params','body','catch','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','reject','save'];(function(_0x1aaf60,_0x40a4c0){var _0x2f49fb=function(_0x5885e5){while(--_0x5885e5){_0x1aaf60['push'](_0x1aaf60['shift']());}};_0x2f49fb(++_0x40a4c0);}(_0x4d64,0x90));var _0x44d6=function(_0x1251c7,_0x283a54){_0x1251c7=_0x1251c7-0x0;var _0x107cfe=_0x4d64[_0x1251c7];return _0x107cfe;};'use strict';var emlformat=require(_0x44d6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x44d6('0x1'));var rp=require(_0x44d6('0x2'));var moment=require(_0x44d6('0x3'));var BPromise=require(_0x44d6('0x4'));var Mustache=require(_0x44d6('0x5'));var util=require('util');var path=require(_0x44d6('0x6'));var sox=require('sox');var csv=require(_0x44d6('0x7'));var ejs=require(_0x44d6('0x8'));var fs=require('fs');var fs_extra=require(_0x44d6('0x9'));var _=require(_0x44d6('0xa'));var squel=require(_0x44d6('0xb'));var crypto=require(_0x44d6('0xc'));var jsforce=require(_0x44d6('0xd'));var deskjs=require(_0x44d6('0xe'));var toCsv=require(_0x44d6('0x7'));var querystring=require(_0x44d6('0xf'));var Papa=require(_0x44d6('0x10'));var Redis=require(_0x44d6('0x11'));var authService=require(_0x44d6('0x12'));var qs=require(_0x44d6('0x13'));var as=require(_0x44d6('0x14'));var hardwareService=require(_0x44d6('0x15'));var logger=require(_0x44d6('0x16'))(_0x44d6('0x17'));var utils=require(_0x44d6('0x18'));var config=require(_0x44d6('0x19'));var licenseUtil=require(_0x44d6('0x1a'));var db=require(_0x44d6('0x1b'))['db'];function respondWithStatusCode(_0x4366ba,_0x57366f){_0x57366f=_0x57366f||0xcc;return function(_0x5ded1f){if(_0x5ded1f){return _0x4366ba[_0x44d6('0x1c')](_0x57366f);}return _0x4366ba['status'](_0x57366f)['end']();};}function respondWithResult(_0x1daa5b,_0x230be4){_0x230be4=_0x230be4||0xc8;return function(_0x177eaf){if(_0x177eaf){return _0x1daa5b['status'](_0x230be4)[_0x44d6('0x1d')](_0x177eaf);}};}function respondWithFilteredResult(_0x30a892,_0x52b4a2){return function(_0x509c0d){if(_0x509c0d){var _0x501127=typeof _0x52b4a2[_0x44d6('0x1e')]===_0x44d6('0x1f')&&typeof _0x52b4a2[_0x44d6('0x20')]===_0x44d6('0x1f');var _0x301652=_0x509c0d[_0x44d6('0x21')];var _0x33f359=_0x501127?0x0:_0x52b4a2[_0x44d6('0x1e')];var _0x1baf53=_0x501127?_0x509c0d['count']:_0x52b4a2[_0x44d6('0x1e')]+_0x52b4a2[_0x44d6('0x20')];var _0xa323;if(_0x1baf53>=_0x301652){_0x1baf53=_0x301652;_0xa323=0xc8;}else{_0xa323=0xce;}_0x30a892[_0x44d6('0x22')](_0xa323);return _0x30a892['set'](_0x44d6('0x23'),_0x33f359+'-'+_0x1baf53+'/'+_0x301652)[_0x44d6('0x1d')](_0x509c0d);}return null;};}function patchUpdates(_0x4da36f){return function(_0x3f051d){try{jsonpatch['apply'](_0x3f051d,_0x4da36f,!![]);}catch(_0x144858){return BPromise[_0x44d6('0x24')](_0x144858);}return _0x3f051d[_0x44d6('0x25')]();};}function saveUpdates(_0x201b6c,_0x52b648){return function(_0xce74b9){if(_0xce74b9){return _0xce74b9['update'](_0x201b6c)['then'](function(_0x3b4585){return _0x3b4585;});}return null;};}function removeEntity(_0x5f43e7,_0x1397b2){return function(_0x158ef8){if(_0x158ef8){return _0x158ef8[_0x44d6('0x26')]()[_0x44d6('0x27')](function(){var _0x2fe9c4=_0x158ef8[_0x44d6('0x28')]({'plain':!![]});var _0x200547=_0x44d6('0x29');return db[_0x44d6('0x2a')]['destroy']({'where':{'type':_0x200547,'resourceId':_0x2fe9c4['id']}})[_0x44d6('0x27')](function(){return _0x158ef8;});})[_0x44d6('0x27')](function(){_0x5f43e7['status'](0xcc)[_0x44d6('0x2b')]();});}};}function handleEntityNotFound(_0x23f25a,_0x2eceda){return function(_0x24b814){if(!_0x24b814){_0x23f25a[_0x44d6('0x1c')](0x194);}return _0x24b814;};}function handleError(_0x2ecd49,_0x44b1c3){_0x44b1c3=_0x44b1c3||0x1f4;return function(_0x24f426){logger[_0x44d6('0x2c')](_0x24f426['stack']);if(_0x24f426[_0x44d6('0x2d')]){delete _0x24f426[_0x44d6('0x2d')];}_0x2ecd49['status'](_0x44b1c3)[_0x44d6('0x2e')](_0x24f426);};}exports['index']=function(_0x2f53ae,_0x525305){var _0x2a6789={},_0x4e4704={},_0x151587={'count':0x0,'rows':[]};var _0x5614a3=_[_0x44d6('0x2f')](db[_0x44d6('0x30')][_0x44d6('0x31')],function(_0x3c43e1){return{'name':_0x3c43e1[_0x44d6('0x32')],'type':_0x3c43e1[_0x44d6('0x33')][_0x44d6('0x34')]};});_0x4e4704['model']=_[_0x44d6('0x2f')](_0x5614a3,_0x44d6('0x2d'));_0x4e4704[_0x44d6('0x35')]=_['keys'](_0x2f53ae[_0x44d6('0x35')]);_0x4e4704[_0x44d6('0x36')]=_[_0x44d6('0x37')](_0x4e4704[_0x44d6('0x38')],_0x4e4704[_0x44d6('0x35')]);_0x2a6789[_0x44d6('0x39')]=_['intersection'](_0x4e4704[_0x44d6('0x38')],qs[_0x44d6('0x3a')](_0x2f53ae[_0x44d6('0x35')][_0x44d6('0x3a')]));_0x2a6789[_0x44d6('0x39')]=_0x2a6789['attributes']['length']?_0x2a6789[_0x44d6('0x39')]:_0x4e4704[_0x44d6('0x38')];if(!_0x2f53ae[_0x44d6('0x35')]['hasOwnProperty'](_0x44d6('0x3b'))){_0x2a6789[_0x44d6('0x20')]=qs[_0x44d6('0x20')](_0x2f53ae['query'][_0x44d6('0x20')]);_0x2a6789[_0x44d6('0x1e')]=qs['offset'](_0x2f53ae[_0x44d6('0x35')][_0x44d6('0x1e')]);}_0x2a6789[_0x44d6('0x3c')]=qs[_0x44d6('0x3d')](_0x2f53ae[_0x44d6('0x35')][_0x44d6('0x3d')]);_0x2a6789[_0x44d6('0x3e')]=qs[_0x44d6('0x36')](_[_0x44d6('0x3f')](_0x2f53ae[_0x44d6('0x35')],_0x4e4704['filters']),_0x5614a3);if(_0x2f53ae[_0x44d6('0x35')][_0x44d6('0x40')]){_0x2a6789['where']=_[_0x44d6('0x41')](_0x2a6789['where'],{'$or':[{'key':{'$like':'%'+_0x2f53ae[_0x44d6('0x35')][_0x44d6('0x40')]+'%'}},{'value':{'$like':'%'+_0x2f53ae[_0x44d6('0x35')][_0x44d6('0x40')]+'%'}}]});}_0x2a6789=_[_0x44d6('0x41')]({},_0x2a6789,_0x2f53ae[_0x44d6('0x42')]);var _0xd2b3f3={'where':_0x2a6789[_0x44d6('0x3e')]};return db[_0x44d6('0x30')][_0x44d6('0x21')](_0xd2b3f3)['then'](function(_0x14befa){_0x151587[_0x44d6('0x21')]=_0x14befa;if(_0x2f53ae[_0x44d6('0x35')]['includeAll']){_0x2a6789[_0x44d6('0x43')]=[{'all':!![]}];}return db[_0x44d6('0x30')][_0x44d6('0x44')](_0x2a6789);})[_0x44d6('0x27')](function(_0x5c324d){_0x151587[_0x44d6('0x45')]=_0x5c324d;return _0x151587;})[_0x44d6('0x27')](respondWithFilteredResult(_0x525305,_0x2a6789))['catch'](handleError(_0x525305,null));};exports[_0x44d6('0x46')]=function(_0x394c55,_0x35fe3b){var _0x35995b={'raw':!![],'where':{'id':_0x394c55['params']['id']}},_0x47a285={};_0x47a285['model']=_[_0x44d6('0x47')](db[_0x44d6('0x30')]['rawAttributes']);_0x47a285['query']=_[_0x44d6('0x47')](_0x394c55[_0x44d6('0x35')]);_0x47a285[_0x44d6('0x36')]=_[_0x44d6('0x37')](_0x47a285[_0x44d6('0x38')],_0x47a285[_0x44d6('0x35')]);_0x35995b[_0x44d6('0x39')]=_[_0x44d6('0x37')](_0x47a285[_0x44d6('0x38')],qs[_0x44d6('0x3a')](_0x394c55[_0x44d6('0x35')][_0x44d6('0x3a')]));_0x35995b[_0x44d6('0x39')]=_0x35995b[_0x44d6('0x39')]['length']?_0x35995b[_0x44d6('0x39')]:_0x47a285[_0x44d6('0x38')];if(_0x394c55[_0x44d6('0x35')][_0x44d6('0x48')]){_0x35995b[_0x44d6('0x43')]=[{'all':!![]}];}_0x35995b=_[_0x44d6('0x41')]({},_0x35995b,_0x394c55['options']);return db[_0x44d6('0x30')]['find'](_0x35995b)[_0x44d6('0x27')](handleEntityNotFound(_0x35fe3b,null))[_0x44d6('0x27')](respondWithResult(_0x35fe3b,null))['catch'](handleError(_0x35fe3b,null));};exports['update']=function(_0x3a7bae,_0x35da24){if(_0x3a7bae['body']['id']){delete _0x3a7bae['body']['id'];}return db['CannedAnswer'][_0x44d6('0x49')]({'where':{'id':_0x3a7bae[_0x44d6('0x4a')]['id']}})[_0x44d6('0x27')](handleEntityNotFound(_0x35da24,null))[_0x44d6('0x27')](saveUpdates(_0x3a7bae[_0x44d6('0x4b')],null))[_0x44d6('0x27')](respondWithResult(_0x35da24,null))[_0x44d6('0x4c')](handleError(_0x35da24,null));};exports[_0x44d6('0x26')]=function(_0x57a66c,_0x161842){return db['CannedAnswer'][_0x44d6('0x49')]({'where':{'id':_0x57a66c[_0x44d6('0x4a')]['id']}})[_0x44d6('0x27')](handleEntityNotFound(_0x161842,null))[_0x44d6('0x27')](removeEntity(_0x161842,null))[_0x44d6('0x4c')](handleError(_0x161842,null));};exports['create']=function(_0x2bed5b,_0x454251){var _0x19c6bb={'key':_0x2bed5b['body'][_0x44d6('0x34')]};if(_0x2bed5b['body']['MailAccountId']){_0x19c6bb[_0x44d6('0x4d')]=_0x2bed5b[_0x44d6('0x4b')][_0x44d6('0x4d')];}else if(_0x2bed5b[_0x44d6('0x4b')]['SmsAccountId']){_0x19c6bb['SmsAccountId']=_0x2bed5b[_0x44d6('0x4b')][_0x44d6('0x4e')];}else if(_0x2bed5b['body'][_0x44d6('0x4f')]){_0x19c6bb[_0x44d6('0x4f')]=_0x2bed5b[_0x44d6('0x4b')][_0x44d6('0x4f')];}else if(_0x2bed5b[_0x44d6('0x4b')][_0x44d6('0x50')]){_0x19c6bb['ChatWebsiteId']=_0x2bed5b[_0x44d6('0x4b')][_0x44d6('0x50')];}return db[_0x44d6('0x30')][_0x44d6('0x49')]({'where':_0x19c6bb})[_0x44d6('0x27')](function(_0x1f7cdf){if(_0x1f7cdf){throw new db[(_0x44d6('0x51'))][(_0x44d6('0x52'))](_0x44d6('0x53'));}return db[_0x44d6('0x30')]['create'](_0x2bed5b[_0x44d6('0x4b')]);})[_0x44d6('0x27')](function(_0x46ba6e){var _0x3b8087=_0x2bed5b[_0x44d6('0x54')][_0x44d6('0x28')]({'plain':!![]});if(!_0x3b8087)throw new Error(_0x44d6('0x55'));if(_0x3b8087[_0x44d6('0x56')]===_0x44d6('0x54')){var _0x4bfca2=_0x46ba6e['get']({'plain':!![]});return db[_0x44d6('0x57')][_0x44d6('0x49')]({'where':{'name':_0x44d6('0x29'),'userProfileId':_0x3b8087[_0x44d6('0x58')]},'raw':!![]})[_0x44d6('0x27')](function(_0x2c4847){if(_0x2c4847&&_0x2c4847['autoAssociation']===0x0){return db[_0x44d6('0x2a')][_0x44d6('0x59')]({'name':_0x4bfca2[_0x44d6('0x2d')],'resourceId':_0x4bfca2['id'],'type':_0x2c4847[_0x44d6('0x2d')],'sectionId':_0x2c4847['id']},{})[_0x44d6('0x27')](function(){return _0x46ba6e;});}else{return _0x46ba6e;}})[_0x44d6('0x4c')](function(_0x4ed7db){logger[_0x44d6('0x2c')](_0x44d6('0x5a'),_0x4ed7db);throw _0x4ed7db;});}return _0x46ba6e;})['then'](respondWithResult(_0x454251,0xc9))['catch'](handleError(_0x454251,null));};
\ No newline at end of file
+var _0x4f3c=['intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','CannedAnswer','rows','catch','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','name','index','map','rawAttributes','fieldName','model','query','filters'];(function(_0x46db35,_0x4bacb6){var _0x18556f=function(_0x3a2e28){while(--_0x3a2e28){_0x46db35['push'](_0x46db35['shift']());}};_0x18556f(++_0x4bacb6);}(_0x4f3c,0x16d));var _0xc4f3=function(_0x34412f,_0x116bea){_0x34412f=_0x34412f-0x0;var _0x4b4b5a=_0x4f3c[_0x34412f];return _0x4b4b5a;};'use strict';var emlformat=require(_0xc4f3('0x0'));var rimraf=require(_0xc4f3('0x1'));var zipdir=require(_0xc4f3('0x2'));var jsonpatch=require(_0xc4f3('0x3'));var rp=require(_0xc4f3('0x4'));var moment=require('moment');var BPromise=require(_0xc4f3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc4f3('0x6'));var sox=require(_0xc4f3('0x7'));var csv=require(_0xc4f3('0x8'));var ejs=require(_0xc4f3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4f3('0xa'));var squel=require(_0xc4f3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc4f3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc4f3('0xd'));var Redis=require(_0xc4f3('0xe'));var authService=require(_0xc4f3('0xf'));var qs=require(_0xc4f3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4f3('0x11'));var logger=require(_0xc4f3('0x12'))('api');var utils=require(_0xc4f3('0x13'));var config=require(_0xc4f3('0x14'));var licenseUtil=require(_0xc4f3('0x15'));var db=require(_0xc4f3('0x16'))['db'];function respondWithStatusCode(_0x319685,_0x16e119){_0x16e119=_0x16e119||0xcc;return function(_0x240030){if(_0x240030){return _0x319685[_0xc4f3('0x17')](_0x16e119);}return _0x319685[_0xc4f3('0x18')](_0x16e119)[_0xc4f3('0x19')]();};}function respondWithResult(_0x2ec3b3,_0x527a28){_0x527a28=_0x527a28||0xc8;return function(_0x276533){if(_0x276533){return _0x2ec3b3[_0xc4f3('0x18')](_0x527a28)[_0xc4f3('0x1a')](_0x276533);}};}function respondWithFilteredResult(_0x5f10ec,_0x89a9a2){return function(_0x3580b9){if(_0x3580b9){var _0x2392fe=typeof _0x89a9a2[_0xc4f3('0x1b')]===_0xc4f3('0x1c')&&typeof _0x89a9a2[_0xc4f3('0x1d')]==='undefined';var _0x62d302=_0x3580b9[_0xc4f3('0x1e')];var _0x18f277=_0x2392fe?0x0:_0x89a9a2[_0xc4f3('0x1b')];var _0x4be2e8=_0x2392fe?_0x3580b9['count']:_0x89a9a2['offset']+_0x89a9a2[_0xc4f3('0x1d')];var _0x3267f5;if(_0x4be2e8>=_0x62d302){_0x4be2e8=_0x62d302;_0x3267f5=0xc8;}else{_0x3267f5=0xce;}_0x5f10ec[_0xc4f3('0x18')](_0x3267f5);return _0x5f10ec[_0xc4f3('0x1f')]('Content-Range',_0x18f277+'-'+_0x4be2e8+'/'+_0x62d302)['json'](_0x3580b9);}return null;};}function patchUpdates(_0x197098){return function(_0x49a350){try{jsonpatch[_0xc4f3('0x20')](_0x49a350,_0x197098,!![]);}catch(_0x42294f){return BPromise[_0xc4f3('0x21')](_0x42294f);}return _0x49a350[_0xc4f3('0x22')]();};}function saveUpdates(_0x2acde4,_0x17fd06){return function(_0x325f2b){if(_0x325f2b){return _0x325f2b[_0xc4f3('0x23')](_0x2acde4)[_0xc4f3('0x24')](function(_0x3e2773){return _0x3e2773;});}return null;};}function removeEntity(_0x1a19be,_0x59f810){return function(_0x21ec01){if(_0x21ec01){return _0x21ec01[_0xc4f3('0x25')]()[_0xc4f3('0x24')](function(){var _0x4fd2d9=_0x21ec01[_0xc4f3('0x26')]({'plain':!![]});var _0x712273=_0xc4f3('0x27');return db[_0xc4f3('0x28')]['destroy']({'where':{'type':_0x712273,'resourceId':_0x4fd2d9['id']}})[_0xc4f3('0x24')](function(){return _0x21ec01;});})['then'](function(){_0x1a19be[_0xc4f3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x253308,_0x3a5966){return function(_0x3028ac){if(!_0x3028ac){_0x253308['sendStatus'](0x194);}return _0x3028ac;};}function handleError(_0x2c407f,_0x348cdd){_0x348cdd=_0x348cdd||0x1f4;return function(_0x2bad5d){logger[_0xc4f3('0x29')](_0x2bad5d['stack']);if(_0x2bad5d['name']){delete _0x2bad5d[_0xc4f3('0x2a')];}_0x2c407f[_0xc4f3('0x18')](_0x348cdd)['send'](_0x2bad5d);};}exports[_0xc4f3('0x2b')]=function(_0x20a613,_0x33588a){var _0x13f1fc={},_0x1f86a7={},_0x2cbc09={'count':0x0,'rows':[]};var _0x127aeb=_[_0xc4f3('0x2c')](db['CannedAnswer'][_0xc4f3('0x2d')],function(_0x28b087){return{'name':_0x28b087[_0xc4f3('0x2e')],'type':_0x28b087['type']['key']};});_0x1f86a7[_0xc4f3('0x2f')]=_['map'](_0x127aeb,'name');_0x1f86a7[_0xc4f3('0x30')]=_['keys'](_0x20a613[_0xc4f3('0x30')]);_0x1f86a7[_0xc4f3('0x31')]=_[_0xc4f3('0x32')](_0x1f86a7[_0xc4f3('0x2f')],_0x1f86a7[_0xc4f3('0x30')]);_0x13f1fc['attributes']=_[_0xc4f3('0x32')](_0x1f86a7[_0xc4f3('0x2f')],qs[_0xc4f3('0x33')](_0x20a613['query'][_0xc4f3('0x33')]));_0x13f1fc[_0xc4f3('0x34')]=_0x13f1fc[_0xc4f3('0x34')][_0xc4f3('0x35')]?_0x13f1fc[_0xc4f3('0x34')]:_0x1f86a7['model'];if(!_0x20a613[_0xc4f3('0x30')]['hasOwnProperty'](_0xc4f3('0x36'))){_0x13f1fc[_0xc4f3('0x1d')]=qs[_0xc4f3('0x1d')](_0x20a613[_0xc4f3('0x30')][_0xc4f3('0x1d')]);_0x13f1fc[_0xc4f3('0x1b')]=qs[_0xc4f3('0x1b')](_0x20a613[_0xc4f3('0x30')][_0xc4f3('0x1b')]);}_0x13f1fc[_0xc4f3('0x37')]=qs[_0xc4f3('0x38')](_0x20a613[_0xc4f3('0x30')][_0xc4f3('0x38')]);_0x13f1fc[_0xc4f3('0x39')]=qs[_0xc4f3('0x31')](_[_0xc4f3('0x3a')](_0x20a613['query'],_0x1f86a7[_0xc4f3('0x31')]),_0x127aeb);if(_0x20a613[_0xc4f3('0x30')][_0xc4f3('0x3b')]){_0x13f1fc[_0xc4f3('0x39')]=_[_0xc4f3('0x3c')](_0x13f1fc[_0xc4f3('0x39')],{'$or':[{'key':{'$like':'%'+_0x20a613[_0xc4f3('0x30')]['filter']+'%'}},{'value':{'$like':'%'+_0x20a613[_0xc4f3('0x30')]['filter']+'%'}}]});}_0x13f1fc=_['merge']({},_0x13f1fc,_0x20a613[_0xc4f3('0x3d')]);var _0x54a851={'where':_0x13f1fc[_0xc4f3('0x39')]};return db['CannedAnswer'][_0xc4f3('0x1e')](_0x54a851)[_0xc4f3('0x24')](function(_0x31f127){_0x2cbc09[_0xc4f3('0x1e')]=_0x31f127;if(_0x20a613[_0xc4f3('0x30')][_0xc4f3('0x3e')]){_0x13f1fc[_0xc4f3('0x3f')]=[{'all':!![]}];}return db[_0xc4f3('0x40')]['findAll'](_0x13f1fc);})[_0xc4f3('0x24')](function(_0x7b76eb){_0x2cbc09[_0xc4f3('0x41')]=_0x7b76eb;return _0x2cbc09;})[_0xc4f3('0x24')](respondWithFilteredResult(_0x33588a,_0x13f1fc))[_0xc4f3('0x42')](handleError(_0x33588a,null));};exports['show']=function(_0x33190b,_0x2565ba){var _0x38fd6e={'raw':!![],'where':{'id':_0x33190b[_0xc4f3('0x43')]['id']}},_0x8705b0={};_0x8705b0[_0xc4f3('0x2f')]=_['keys'](db['CannedAnswer'][_0xc4f3('0x2d')]);_0x8705b0[_0xc4f3('0x30')]=_[_0xc4f3('0x44')](_0x33190b[_0xc4f3('0x30')]);_0x8705b0[_0xc4f3('0x31')]=_[_0xc4f3('0x32')](_0x8705b0[_0xc4f3('0x2f')],_0x8705b0['query']);_0x38fd6e[_0xc4f3('0x34')]=_[_0xc4f3('0x32')](_0x8705b0['model'],qs[_0xc4f3('0x33')](_0x33190b[_0xc4f3('0x30')][_0xc4f3('0x33')]));_0x38fd6e[_0xc4f3('0x34')]=_0x38fd6e[_0xc4f3('0x34')][_0xc4f3('0x35')]?_0x38fd6e[_0xc4f3('0x34')]:_0x8705b0[_0xc4f3('0x2f')];if(_0x33190b[_0xc4f3('0x30')][_0xc4f3('0x3e')]){_0x38fd6e[_0xc4f3('0x3f')]=[{'all':!![]}];}_0x38fd6e=_[_0xc4f3('0x3c')]({},_0x38fd6e,_0x33190b['options']);return db[_0xc4f3('0x40')][_0xc4f3('0x45')](_0x38fd6e)['then'](handleEntityNotFound(_0x2565ba,null))['then'](respondWithResult(_0x2565ba,null))[_0xc4f3('0x42')](handleError(_0x2565ba,null));};exports['update']=function(_0x1de5cf,_0x2cf88d){if(_0x1de5cf[_0xc4f3('0x46')]['id']){delete _0x1de5cf[_0xc4f3('0x46')]['id'];}return db['CannedAnswer'][_0xc4f3('0x45')]({'where':{'id':_0x1de5cf[_0xc4f3('0x43')]['id']}})[_0xc4f3('0x24')](handleEntityNotFound(_0x2cf88d,null))[_0xc4f3('0x24')](saveUpdates(_0x1de5cf[_0xc4f3('0x46')],null))[_0xc4f3('0x24')](respondWithResult(_0x2cf88d,null))['catch'](handleError(_0x2cf88d,null));};exports['destroy']=function(_0x5920ad,_0x556629){return db[_0xc4f3('0x40')][_0xc4f3('0x45')]({'where':{'id':_0x5920ad[_0xc4f3('0x43')]['id']}})[_0xc4f3('0x24')](handleEntityNotFound(_0x556629,null))[_0xc4f3('0x24')](removeEntity(_0x556629,null))[_0xc4f3('0x42')](handleError(_0x556629,null));};exports[_0xc4f3('0x47')]=function(_0x4c8fff,_0x5e9b38){var _0x294407={'key':_0x4c8fff[_0xc4f3('0x46')]['key']};if(_0x4c8fff[_0xc4f3('0x46')][_0xc4f3('0x48')]){_0x294407[_0xc4f3('0x48')]=_0x4c8fff[_0xc4f3('0x46')]['MailAccountId'];}else if(_0x4c8fff[_0xc4f3('0x46')]['SmsAccountId']){_0x294407[_0xc4f3('0x49')]=_0x4c8fff['body'][_0xc4f3('0x49')];}else if(_0x4c8fff[_0xc4f3('0x46')]['OpenchannelAccountId']){_0x294407[_0xc4f3('0x4a')]=_0x4c8fff[_0xc4f3('0x46')][_0xc4f3('0x4a')];}else if(_0x4c8fff[_0xc4f3('0x46')][_0xc4f3('0x4b')]){_0x294407['ChatWebsiteId']=_0x4c8fff[_0xc4f3('0x46')][_0xc4f3('0x4b')];}return db[_0xc4f3('0x40')][_0xc4f3('0x45')]({'where':_0x294407})[_0xc4f3('0x24')](function(_0x97bf9a){if(_0x97bf9a){throw new db[(_0xc4f3('0x4c'))][(_0xc4f3('0x4d'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xc4f3('0x40')][_0xc4f3('0x47')](_0x4c8fff[_0xc4f3('0x46')]);})[_0xc4f3('0x24')](function(_0x51d038){var _0x24f01a=_0x4c8fff['user'][_0xc4f3('0x26')]({'plain':!![]});if(!_0x24f01a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24f01a[_0xc4f3('0x4e')]==='user'){var _0x3e9f2a=_0x51d038[_0xc4f3('0x26')]({'plain':!![]});return db[_0xc4f3('0x4f')][_0xc4f3('0x45')]({'where':{'name':'CannedAnswers','userProfileId':_0x24f01a[_0xc4f3('0x50')]},'raw':!![]})[_0xc4f3('0x24')](function(_0x5dee8e){if(_0x5dee8e&&_0x5dee8e[_0xc4f3('0x51')]===0x0){return db['UserProfileResource'][_0xc4f3('0x47')]({'name':_0x3e9f2a[_0xc4f3('0x2a')],'resourceId':_0x3e9f2a['id'],'type':_0x5dee8e['name'],'sectionId':_0x5dee8e['id']},{})[_0xc4f3('0x24')](function(){return _0x51d038;});}else{return _0x51d038;}})[_0xc4f3('0x42')](function(_0x2ff000){logger[_0xc4f3('0x29')](_0xc4f3('0x52'),_0x2ff000);throw _0x2ff000;});}return _0x51d038;})[_0xc4f3('0x24')](respondWithResult(_0x5e9b38,0xc9))[_0xc4f3('0x42')](handleError(_0x5e9b38,null));};
\ No newline at end of file