Built motion from commit (unavailable).|2.5.13
[motion2.git] / server / api / intDeskConfiguration / intDeskConfiguration.controller.js
index 4914dc1..09650ae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x44f6=['status','end','count','offset','limit','Content-Range','json','apply','save','update','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','intersection','find','create','body','getFields','findOne','DeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x44f6,0x1b2));var _0x644f=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x44f6[_0x3d42d8];return _0x27fc41;};'use strict';var pdf=require(_0x644f('0x0'));var emlformat=require(_0x644f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x644f('0x2'));var jsonpatch=require(_0x644f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x644f('0x4'));var Mustache=require(_0x644f('0x5'));var util=require(_0x644f('0x6'));var path=require(_0x644f('0x7'));var sox=require(_0x644f('0x8'));var csv=require(_0x644f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x644f('0xa'));var squel=require(_0x644f('0xb'));var crypto=require(_0x644f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x644f('0xd'));var toCsv=require(_0x644f('0x9'));var querystring=require(_0x644f('0xe'));var Papa=require(_0x644f('0xf'));var Redis=require(_0x644f('0x10'));var authService=require(_0x644f('0x11'));var qs=require(_0x644f('0x12'));var as=require(_0x644f('0x13'));var hardwareService=require(_0x644f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x644f('0x15'));var config=require(_0x644f('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x644f('0x17'));var client=jayson[_0x644f('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x5c755a,_0x306321,_0x547e7c){if(_0x547e7c){var _0x3de199=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3de199['test'](_0x306321)){return _0x5c755a;}else{throw new db[(_0x644f('0x19'))][(_0x644f('0x1a'))](_0x644f('0x1b'));}}else{return _0x5c755a;}}function respondWithRpcPromise(_0x114c6,_0x181b10,_0x163106,_0x530cfa){return new BPromise(function(_0x1ebbd3,_0x2d1037){var _0x221a91=_0x530cfa||client;return _0x221a91['request'](_0x114c6,_0x163106)[_0x644f('0x1c')](function(_0x143083){logger[_0x644f('0x1d')]('DeskConfiguration,\x20%s,\x20%s',_0x181b10,_0x644f('0x1e'));logger[_0x644f('0x1f')](_0x644f('0x20'),_0x181b10,'request\x20sent',JSON[_0x644f('0x21')](_0x143083));if(_0x143083[_0x644f('0x22')]){if(_0x143083[_0x644f('0x22')][_0x644f('0x23')]===0x1f4){logger[_0x644f('0x22')](_0x644f('0x24'),_0x181b10,_0x143083['error'][_0x644f('0x25')]);return _0x2d1037(_0x143083[_0x644f('0x22')][_0x644f('0x25')]);}logger[_0x644f('0x22')](_0x644f('0x24'),_0x181b10,_0x143083[_0x644f('0x22')][_0x644f('0x25')]);return _0x1ebbd3(_0x143083[_0x644f('0x22')][_0x644f('0x25')]);}else{logger[_0x644f('0x1d')](_0x644f('0x24'),_0x181b10,_0x644f('0x1e'));_0x1ebbd3(_0x143083[_0x644f('0x26')][_0x644f('0x25')]);}})[_0x644f('0x27')](function(_0x45f27a){logger['error'](_0x644f('0x24'),_0x181b10,_0x45f27a);_0x2d1037(_0x45f27a);});});}function respondWithStatusCode(_0x576777,_0x39fd54){_0x39fd54=_0x39fd54||0xcc;return function(_0x258ee6){if(_0x258ee6){return _0x576777[_0x644f('0x28')](_0x39fd54);}return _0x576777[_0x644f('0x29')](_0x39fd54)[_0x644f('0x2a')]();};}function respondWithResult(_0x1a6cb7,_0xc12677){_0xc12677=_0xc12677||0xc8;return function(_0x589783){if(_0x589783){return _0x1a6cb7[_0x644f('0x29')](_0xc12677)['json'](_0x589783);}};}function respondWithFilteredResult(_0x5933d0,_0x2fe408){return function(_0x238351){if(_0x238351){var _0x4b59fe=_0x238351[_0x644f('0x2b')],_0x3f5f0e=_0x2fe408[_0x644f('0x2c')],_0x59456e=_0x2fe408[_0x644f('0x2c')]+_0x2fe408[_0x644f('0x2d')],_0x14d86a;if(_0x59456e>=_0x4b59fe){_0x59456e=_0x4b59fe;_0x14d86a=0xc8;}else{_0x14d86a=0xce;}_0x5933d0[_0x644f('0x29')](_0x14d86a);return _0x5933d0['set'](_0x644f('0x2e'),_0x3f5f0e+'-'+_0x59456e+'/'+_0x4b59fe)[_0x644f('0x2f')](_0x238351);}return null;};}function patchUpdates(_0x2b225a){return function(_0x3ecd40){try{jsonpatch[_0x644f('0x30')](_0x3ecd40,_0x2b225a,!![]);}catch(_0x4f460f){return BPromise['reject'](_0x4f460f);}return _0x3ecd40[_0x644f('0x31')]();};}function saveUpdates(_0x30c2eb,_0x354381){return function(_0x11bfd9){if(_0x11bfd9){return _0x11bfd9[_0x644f('0x32')](_0x30c2eb)[_0x644f('0x1c')](function(_0x49a156){return _0x49a156;});}return null;};}function removeEntity(_0x28292d,_0x34fb0a){return function(_0xa3b62a){if(_0xa3b62a){return _0xa3b62a['destroy']()[_0x644f('0x1c')](function(){_0x28292d[_0x644f('0x29')](0xcc)[_0x644f('0x2a')]();});}};}function handleEntityNotFound(_0xe07802,_0x4b669b){return function(_0x4a5102){if(!_0x4a5102){_0xe07802[_0x644f('0x28')](0x194);}return _0x4a5102;};}function handleError(_0x156952,_0x25d5f0){_0x25d5f0=_0x25d5f0||0x1f4;return function(_0x41b2c5){logger['error'](_0x41b2c5['stack']);if(_0x41b2c5[_0x644f('0x33')]){delete _0x41b2c5[_0x644f('0x33')];}_0x156952[_0x644f('0x29')](_0x25d5f0)[_0x644f('0x34')](_0x41b2c5);};}exports[_0x644f('0x35')]=function(_0x17a030,_0x49640c){var _0x5398c7={},_0x5f1319={},_0x2518d9={'count':0x0,'rows':[]};var _0x4a1af7=_[_0x644f('0x36')](db[_0x644f('0x37')][_0x644f('0x38')],function(_0x2ec5ec){return{'name':_0x2ec5ec[_0x644f('0x39')],'type':_0x2ec5ec[_0x644f('0x3a')][_0x644f('0x3b')]};});_0x5f1319[_0x644f('0x3c')]=_[_0x644f('0x36')](_0x4a1af7,_0x644f('0x33'));_0x5f1319[_0x644f('0x3d')]=_[_0x644f('0x3e')](_0x17a030['query']);_0x5f1319['filters']=_['intersection'](_0x5f1319[_0x644f('0x3c')],_0x5f1319[_0x644f('0x3d')]);_0x5398c7[_0x644f('0x3f')]=_['intersection'](_0x5f1319[_0x644f('0x3c')],qs[_0x644f('0x40')](_0x17a030[_0x644f('0x3d')][_0x644f('0x40')]));_0x5398c7[_0x644f('0x3f')]=_0x5398c7[_0x644f('0x3f')][_0x644f('0x41')]?_0x5398c7[_0x644f('0x3f')]:_0x5f1319[_0x644f('0x3c')];if(!_0x17a030[_0x644f('0x3d')]['hasOwnProperty'](_0x644f('0x42'))){_0x5398c7['limit']=qs['limit'](_0x17a030['query'][_0x644f('0x2d')]);_0x5398c7[_0x644f('0x2c')]=qs[_0x644f('0x2c')](_0x17a030[_0x644f('0x3d')]['offset']);}_0x5398c7[_0x644f('0x43')]=qs[_0x644f('0x44')](_0x17a030['query'][_0x644f('0x44')]);_0x5398c7[_0x644f('0x45')]=qs['filters'](_[_0x644f('0x46')](_0x17a030['query'],_0x5f1319[_0x644f('0x47')]));if(_0x17a030['query']['filter']){_0x5398c7[_0x644f('0x45')]=_['merge'](_0x5398c7[_0x644f('0x45')],{'$or':_[_0x644f('0x36')](_0x4a1af7,function(_0x1ee532){if(_0x1ee532[_0x644f('0x3a')]!==_0x644f('0x48')){var _0x4ee0e4={};_0x4ee0e4[_0x1ee532[_0x644f('0x33')]]={'$like':'%'+_0x17a030[_0x644f('0x3d')][_0x644f('0x49')]+'%'};return _0x4ee0e4;}})});}_0x5398c7=_[_0x644f('0x4a')]({},_0x5398c7,_0x17a030[_0x644f('0x4b')]);var _0x7031ae={'where':_0x5398c7[_0x644f('0x45')]};return db[_0x644f('0x37')]['count'](_0x7031ae)['then'](function(_0x1537e0){_0x2518d9[_0x644f('0x2b')]=_0x1537e0;if(_0x17a030[_0x644f('0x3d')][_0x644f('0x4c')]){_0x5398c7[_0x644f('0x4d')]=[{'all':!![]}];}return db[_0x644f('0x37')]['findAll'](_0x5398c7);})[_0x644f('0x1c')](function(_0x4d4c9d){_0x2518d9[_0x644f('0x4e')]=_0x4d4c9d;return _0x2518d9;})[_0x644f('0x1c')](respondWithFilteredResult(_0x49640c,_0x5398c7))[_0x644f('0x27')](handleError(_0x49640c,null));};exports[_0x644f('0x4f')]=function(_0x31f382,_0x3f2831){var _0x3dd7b2={'raw':![],'where':{'id':_0x31f382[_0x644f('0x50')]['id']}},_0x122667={};_0x122667[_0x644f('0x3c')]=_[_0x644f('0x3e')](db[_0x644f('0x37')]['rawAttributes']);_0x122667['query']=_[_0x644f('0x3e')](_0x31f382[_0x644f('0x3d')]);_0x122667[_0x644f('0x47')]=_[_0x644f('0x51')](_0x122667['model'],_0x122667['query']);_0x3dd7b2['attributes']=_[_0x644f('0x51')](_0x122667['model'],qs[_0x644f('0x40')](_0x31f382[_0x644f('0x3d')][_0x644f('0x40')]));_0x3dd7b2['attributes']=_0x3dd7b2[_0x644f('0x3f')][_0x644f('0x41')]?_0x3dd7b2[_0x644f('0x3f')]:_0x122667[_0x644f('0x3c')];if(_0x31f382[_0x644f('0x3d')][_0x644f('0x4c')]){_0x3dd7b2[_0x644f('0x4d')]=[{'all':!![]}];}_0x3dd7b2=_[_0x644f('0x4a')]({},_0x3dd7b2,_0x31f382[_0x644f('0x4b')]);return db['DeskConfiguration'][_0x644f('0x52')](_0x3dd7b2)['then'](handleEntityNotFound(_0x3f2831,null))[_0x644f('0x1c')](respondWithResult(_0x3f2831,null))[_0x644f('0x27')](handleError(_0x3f2831,null));};exports[_0x644f('0x53')]=function(_0x2c33f1,_0x33d1d6){return db['DeskConfiguration'][_0x644f('0x53')](_0x2c33f1['body'],{})[_0x644f('0x1c')](respondWithResult(_0x33d1d6,0xc9))['catch'](handleError(_0x33d1d6,null));};exports[_0x644f('0x32')]=function(_0x1a27cf,_0x15afbd){if(_0x1a27cf[_0x644f('0x54')]['id']){delete _0x1a27cf[_0x644f('0x54')]['id'];}return db[_0x644f('0x37')][_0x644f('0x52')]({'where':{'id':_0x1a27cf[_0x644f('0x50')]['id']}})[_0x644f('0x1c')](handleEntityNotFound(_0x15afbd,null))[_0x644f('0x1c')](saveUpdates(_0x1a27cf['body'],null))[_0x644f('0x1c')](respondWithResult(_0x15afbd,null))[_0x644f('0x27')](handleError(_0x15afbd,null));};exports['destroy']=function(_0x5ef6dc,_0x3436d7){return db[_0x644f('0x37')][_0x644f('0x52')]({'where':{'id':_0x5ef6dc[_0x644f('0x50')]['id']}})[_0x644f('0x1c')](handleEntityNotFound(_0x3436d7,null))[_0x644f('0x1c')](removeEntity(_0x3436d7,null))['catch'](handleError(_0x3436d7,null));};exports[_0x644f('0x55')]=function(_0x208e99,_0x49141b,_0x56fc9b){var _0x44165f={};var _0x58ef49={};var _0x137434;var _0x55cbbd;return db[_0x644f('0x37')][_0x644f('0x56')]({'where':{'id':_0x208e99[_0x644f('0x50')]['id']}})[_0x644f('0x1c')](handleEntityNotFound(_0x49141b,null))['then'](function(_0x5e1271){if(_0x5e1271){_0x137434=_0x5e1271;_0x58ef49['model']=_[_0x644f('0x3e')](db[_0x644f('0x57')][_0x644f('0x38')]);_0x58ef49[_0x644f('0x3d')]=_[_0x644f('0x3e')](_0x208e99[_0x644f('0x3d')]);_0x58ef49[_0x644f('0x47')]=_[_0x644f('0x51')](_0x58ef49[_0x644f('0x3c')],_0x58ef49[_0x644f('0x3d')]);_0x44165f[_0x644f('0x3f')]=_[_0x644f('0x51')](_0x58ef49[_0x644f('0x3c')],qs[_0x644f('0x40')](_0x208e99[_0x644f('0x3d')][_0x644f('0x40')]));_0x44165f[_0x644f('0x3f')]=_0x44165f['attributes'][_0x644f('0x41')]?_0x44165f[_0x644f('0x3f')]:_0x58ef49['model'];_0x44165f['order']=qs[_0x644f('0x44')](_0x208e99[_0x644f('0x3d')]['sort']);_0x44165f[_0x644f('0x45')]=qs[_0x644f('0x47')](_[_0x644f('0x46')](_0x208e99['query'],_0x58ef49[_0x644f('0x47')]));if(_0x208e99[_0x644f('0x3d')][_0x644f('0x49')]){_0x44165f[_0x644f('0x45')]=_[_0x644f('0x4a')](_0x44165f[_0x644f('0x45')],{'$or':_['map'](_0x44165f[_0x644f('0x3f')],function(_0x36bc65){var _0x2f9f88={};_0x2f9f88[_0x36bc65]={'$like':'%'+_0x208e99['query']['filter']+'%'};return _0x2f9f88;})});}_0x44165f=_[_0x644f('0x4a')]({},_0x44165f,_0x208e99[_0x644f('0x4b')]);return _0x137434[_0x644f('0x55')](_0x44165f);}})[_0x644f('0x1c')](function(_0x6f0e64){if(_0x6f0e64){_0x55cbbd=_0x6f0e64[_0x644f('0x41')];if(!_0x208e99['query']['hasOwnProperty'](_0x644f('0x42'))){_0x44165f[_0x644f('0x2d')]=qs[_0x644f('0x2d')](_0x208e99[_0x644f('0x3d')][_0x644f('0x2d')]);_0x44165f[_0x644f('0x2c')]=qs[_0x644f('0x2c')](_0x208e99[_0x644f('0x3d')][_0x644f('0x2c')]);}return _0x137434[_0x644f('0x55')](_0x44165f);}})['then'](function(_0xb47b77){if(_0xb47b77){return _0xb47b77?{'count':_0x55cbbd,'rows':_0xb47b77}:null;}})[_0x644f('0x1c')](respondWithResult(_0x49141b,null))[_0x644f('0x27')](handleError(_0x49141b,null));};exports[_0x644f('0x58')]=function(_0x4df805,_0x81255c,_0x5025fc){var _0x289d90={};var _0x5212e8={};var _0x477e30;var _0x4caf6d;return db[_0x644f('0x37')][_0x644f('0x56')]({'where':{'id':_0x4df805[_0x644f('0x50')]['id']}})[_0x644f('0x1c')](handleEntityNotFound(_0x81255c,null))[_0x644f('0x1c')](function(_0x59cdff){if(_0x59cdff){_0x477e30=_0x59cdff;_0x5212e8[_0x644f('0x3c')]=_['keys'](db[_0x644f('0x57')][_0x644f('0x38')]);_0x5212e8['query']=_[_0x644f('0x3e')](_0x4df805['query']);_0x5212e8['filters']=_[_0x644f('0x51')](_0x5212e8['model'],_0x5212e8[_0x644f('0x3d')]);_0x289d90[_0x644f('0x3f')]=_[_0x644f('0x51')](_0x5212e8[_0x644f('0x3c')],qs[_0x644f('0x40')](_0x4df805[_0x644f('0x3d')][_0x644f('0x40')]));_0x289d90[_0x644f('0x3f')]=_0x289d90[_0x644f('0x3f')][_0x644f('0x41')]?_0x289d90[_0x644f('0x3f')]:_0x5212e8[_0x644f('0x3c')];_0x289d90['order']=qs[_0x644f('0x44')](_0x4df805['query'][_0x644f('0x44')]);_0x289d90['where']=qs['filters'](_['pick'](_0x4df805[_0x644f('0x3d')],_0x5212e8[_0x644f('0x47')]));if(_0x4df805[_0x644f('0x3d')][_0x644f('0x49')]){_0x289d90[_0x644f('0x45')]=_[_0x644f('0x4a')](_0x289d90[_0x644f('0x45')],{'$or':_[_0x644f('0x36')](_0x289d90[_0x644f('0x3f')],function(_0x37e9af){var _0x5ca30e={};_0x5ca30e[_0x37e9af]={'$like':'%'+_0x4df805[_0x644f('0x3d')][_0x644f('0x49')]+'%'};return _0x5ca30e;})});}_0x289d90=_['merge']({},_0x289d90,_0x4df805['options']);return _0x477e30['getSubjects'](_0x289d90);}})[_0x644f('0x1c')](function(_0x567fb7){if(_0x567fb7){_0x4caf6d=_0x567fb7['length'];if(!_0x4df805[_0x644f('0x3d')][_0x644f('0x59')](_0x644f('0x42'))){_0x289d90['limit']=qs[_0x644f('0x2d')](_0x4df805[_0x644f('0x3d')][_0x644f('0x2d')]);_0x289d90['offset']=qs['offset'](_0x4df805[_0x644f('0x3d')][_0x644f('0x2c')]);}return _0x477e30[_0x644f('0x58')](_0x289d90);}})[_0x644f('0x1c')](function(_0x1b9e4b){if(_0x1b9e4b){return _0x1b9e4b?{'count':_0x4caf6d,'rows':_0x1b9e4b}:null;}})[_0x644f('0x1c')](respondWithResult(_0x81255c,null))[_0x644f('0x27')](handleError(_0x81255c,null));};exports[_0x644f('0x5a')]=function(_0x5430a4,_0x5b93ae,_0x20b9ec){var _0x56cb34={};var _0x209ffa={};var _0x40135c;var _0x28d04c;return db['DeskConfiguration'][_0x644f('0x56')]({'where':{'id':_0x5430a4[_0x644f('0x50')]['id']}})[_0x644f('0x1c')](handleEntityNotFound(_0x5b93ae,null))[_0x644f('0x1c')](function(_0x56ff46){if(_0x56ff46){_0x40135c=_0x56ff46;_0x209ffa['model']=_[_0x644f('0x3e')](db[_0x644f('0x57')][_0x644f('0x38')]);_0x209ffa['query']=_['keys'](_0x5430a4[_0x644f('0x3d')]);_0x209ffa[_0x644f('0x47')]=_[_0x644f('0x51')](_0x209ffa[_0x644f('0x3c')],_0x209ffa[_0x644f('0x3d')]);_0x56cb34['attributes']=_[_0x644f('0x51')](_0x209ffa[_0x644f('0x3c')],qs[_0x644f('0x40')](_0x5430a4[_0x644f('0x3d')][_0x644f('0x40')]));_0x56cb34[_0x644f('0x3f')]=_0x56cb34[_0x644f('0x3f')][_0x644f('0x41')]?_0x56cb34[_0x644f('0x3f')]:_0x209ffa[_0x644f('0x3c')];_0x56cb34[_0x644f('0x43')]=qs[_0x644f('0x44')](_0x5430a4[_0x644f('0x3d')][_0x644f('0x44')]);_0x56cb34[_0x644f('0x45')]=qs[_0x644f('0x47')](_[_0x644f('0x46')](_0x5430a4[_0x644f('0x3d')],_0x209ffa[_0x644f('0x47')]));if(_0x5430a4[_0x644f('0x3d')][_0x644f('0x49')]){_0x56cb34['where']=_[_0x644f('0x4a')](_0x56cb34[_0x644f('0x45')],{'$or':_['map'](_0x56cb34[_0x644f('0x3f')],function(_0x32df21){var _0x54eed2={};_0x54eed2[_0x32df21]={'$like':'%'+_0x5430a4[_0x644f('0x3d')][_0x644f('0x49')]+'%'};return _0x54eed2;})});}_0x56cb34=_['merge']({},_0x56cb34,_0x5430a4[_0x644f('0x4b')]);return _0x40135c['getDescriptions'](_0x56cb34);}})[_0x644f('0x1c')](function(_0x1fd5bc){if(_0x1fd5bc){_0x28d04c=_0x1fd5bc[_0x644f('0x41')];if(!_0x5430a4['query'][_0x644f('0x59')](_0x644f('0x42'))){_0x56cb34[_0x644f('0x2d')]=qs[_0x644f('0x2d')](_0x5430a4['query'][_0x644f('0x2d')]);_0x56cb34[_0x644f('0x2c')]=qs['offset'](_0x5430a4[_0x644f('0x3d')][_0x644f('0x2c')]);}return _0x40135c['getDescriptions'](_0x56cb34);}})[_0x644f('0x1c')](function(_0x123c0a){if(_0x123c0a){return _0x123c0a?{'count':_0x28d04c,'rows':_0x123c0a}:null;}})[_0x644f('0x1c')](respondWithResult(_0x5b93ae,null))[_0x644f('0x27')](handleError(_0x5b93ae,null));};exports[_0x644f('0x5b')]=function(_0x2bf098,_0x35ea49,_0x3ae2cb){var _0x48ecd={};var _0x3cca43={};var _0x12f9d9;var _0x4c3de2;return db[_0x644f('0x37')][_0x644f('0x56')]({'where':{'id':_0x2bf098[_0x644f('0x50')]['id']}})[_0x644f('0x1c')](handleEntityNotFound(_0x35ea49,null))[_0x644f('0x1c')](function(_0x5f4b17){if(_0x5f4b17){_0x12f9d9=_0x5f4b17;_0x3cca43['model']=_[_0x644f('0x3e')](db[_0x644f('0x5c')][_0x644f('0x38')]);_0x3cca43[_0x644f('0x3d')]=_[_0x644f('0x3e')](_0x2bf098[_0x644f('0x3d')]);_0x3cca43[_0x644f('0x47')]=_['intersection'](_0x3cca43[_0x644f('0x3c')],_0x3cca43[_0x644f('0x3d')]);_0x48ecd['attributes']=_[_0x644f('0x51')](_0x3cca43['model'],qs[_0x644f('0x40')](_0x2bf098[_0x644f('0x3d')][_0x644f('0x40')]));_0x48ecd[_0x644f('0x3f')]=_0x48ecd[_0x644f('0x3f')][_0x644f('0x41')]?_0x48ecd[_0x644f('0x3f')]:_0x3cca43[_0x644f('0x3c')];_0x48ecd['order']=qs[_0x644f('0x44')](_0x2bf098['query'][_0x644f('0x44')]);_0x48ecd[_0x644f('0x45')]=qs[_0x644f('0x47')](_[_0x644f('0x46')](_0x2bf098['query'],_0x3cca43[_0x644f('0x47')]));if(_0x2bf098['query']['filter']){_0x48ecd['where']=_['merge'](_0x48ecd[_0x644f('0x45')],{'$or':_[_0x644f('0x36')](_0x48ecd[_0x644f('0x3f')],function(_0x226029){var _0x22ced5={};_0x22ced5[_0x226029]={'$like':'%'+_0x2bf098[_0x644f('0x3d')]['filter']+'%'};return _0x22ced5;})});}_0x48ecd=_[_0x644f('0x4a')]({},_0x48ecd,_0x2bf098[_0x644f('0x4b')]);return _0x12f9d9[_0x644f('0x5b')](_0x48ecd);}})[_0x644f('0x1c')](function(_0x33849a){if(_0x33849a){_0x4c3de2=_0x33849a[_0x644f('0x41')];if(!_0x2bf098[_0x644f('0x3d')]['hasOwnProperty']('nolimit')){_0x48ecd[_0x644f('0x2d')]=qs[_0x644f('0x2d')](_0x2bf098[_0x644f('0x3d')][_0x644f('0x2d')]);_0x48ecd[_0x644f('0x2c')]=qs[_0x644f('0x2c')](_0x2bf098[_0x644f('0x3d')][_0x644f('0x2c')]);}return _0x12f9d9[_0x644f('0x5b')](_0x48ecd);}})[_0x644f('0x1c')](function(_0x2330ba){if(_0x2330ba){return _0x2330ba?{'count':_0x4c3de2,'rows':_0x2330ba}:null;}})[_0x644f('0x1c')](respondWithResult(_0x35ea49,null))[_0x644f('0x27')](handleError(_0x35ea49,null));};exports[_0x644f('0x5d')]=function(_0x27ba08,_0x4e98d0,_0x189f67){if(_0x27ba08[_0x644f('0x54')]['id']){delete _0x27ba08[_0x644f('0x54')]['id'];}return db[_0x644f('0x37')][_0x644f('0x56')]({'where':{'id':_0x27ba08['params']['id']}})[_0x644f('0x1c')](handleEntityNotFound(_0x4e98d0,null))[_0x644f('0x1c')](function(_0x557f59){if(_0x557f59){return _0x557f59[_0x644f('0x5d')](_0x27ba08['body'][_0x644f('0x5e')]||[]);}return null;})[_0x644f('0x1c')](respondWithResult(_0x4e98d0,null))[_0x644f('0x27')](handleError(_0x4e98d0,null));};
\ No newline at end of file
+var _0x370c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','save','destroy','then','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','DeskConfiguration','include','findAll','show','params','keys','find','create','body','getFields','findOne','DeskField','pick','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x562463,_0x5271c0){var _0x44bede=function(_0x22eb5e){while(--_0x22eb5e){_0x562463['push'](_0x562463['shift']());}};_0x44bede(++_0x5271c0);}(_0x370c,0x106));var _0xc370=function(_0x8a6eec,_0x4da550){_0x8a6eec=_0x8a6eec-0x0;var _0x1c4075=_0x370c[_0x8a6eec];return _0x1c4075;};'use strict';var pdf=require(_0xc370('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc370('0x1'));var zipdir=require(_0xc370('0x2'));var jsonpatch=require(_0xc370('0x3'));var rp=require('request-promise');var moment=require(_0xc370('0x4'));var BPromise=require(_0xc370('0x5'));var Mustache=require(_0xc370('0x6'));var util=require(_0xc370('0x7'));var path=require(_0xc370('0x8'));var sox=require(_0xc370('0x9'));var csv=require('to-csv');var ejs=require(_0xc370('0xa'));var fs=require('fs');var _=require(_0xc370('0xb'));var squel=require(_0xc370('0xc'));var crypto=require(_0xc370('0xd'));var jsforce=require(_0xc370('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc370('0xf'));var querystring=require(_0xc370('0x10'));var Papa=require(_0xc370('0x11'));var Redis=require(_0xc370('0x12'));var authService=require(_0xc370('0x13'));var qs=require(_0xc370('0x14'));var as=require(_0xc370('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc370('0x16'))(_0xc370('0x17'));var utils=require(_0xc370('0x18'));var config=require(_0xc370('0x19'));var licenseUtil=require(_0xc370('0x1a'));var db=require(_0xc370('0x1b'))['db'];var jayson=require(_0xc370('0x1c'));var client=jayson['client'][_0xc370('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xff6975,_0x138ff6,_0x1736f1,_0x374455){return new BPromise(function(_0x28397b,_0x18ea8e){var _0x2f5c68=_0x374455||client;return _0x2f5c68['request'](_0xff6975,_0x1736f1)['then'](function(_0x3bc121){logger[_0xc370('0x1e')](_0xc370('0x1f'),_0x138ff6,_0xc370('0x20'));logger[_0xc370('0x21')](_0xc370('0x22'),_0x138ff6,_0xc370('0x20'),JSON[_0xc370('0x23')](_0x3bc121));if(_0x3bc121['error']){if(_0x3bc121['error'][_0xc370('0x24')]===0x1f4){logger['error'](_0xc370('0x1f'),_0x138ff6,_0x3bc121[_0xc370('0x25')][_0xc370('0x26')]);return _0x18ea8e(_0x3bc121[_0xc370('0x25')]['message']);}logger[_0xc370('0x25')]('DeskConfiguration,\x20%s,\x20%s',_0x138ff6,_0x3bc121[_0xc370('0x25')][_0xc370('0x26')]);return _0x28397b(_0x3bc121[_0xc370('0x25')][_0xc370('0x26')]);}else{logger[_0xc370('0x1e')]('DeskConfiguration,\x20%s,\x20%s',_0x138ff6,'request\x20sent');_0x28397b(_0x3bc121[_0xc370('0x27')][_0xc370('0x26')]);}})[_0xc370('0x28')](function(_0x34fb33){logger['error'](_0xc370('0x1f'),_0x138ff6,_0x34fb33);_0x18ea8e(_0x34fb33);});});}function respondWithStatusCode(_0x447c51,_0x3f39d2){_0x3f39d2=_0x3f39d2||0xcc;return function(_0x1da40c){if(_0x1da40c){return _0x447c51[_0xc370('0x29')](_0x3f39d2);}return _0x447c51[_0xc370('0x2a')](_0x3f39d2)[_0xc370('0x2b')]();};}function respondWithResult(_0x4542fc,_0x17ec6d){_0x17ec6d=_0x17ec6d||0xc8;return function(_0x39aba1){if(_0x39aba1){return _0x4542fc[_0xc370('0x2a')](_0x17ec6d)[_0xc370('0x2c')](_0x39aba1);}};}function respondWithFilteredResult(_0x41ee86,_0x160a71){return function(_0x3e4e24){if(_0x3e4e24){var _0x3871d6=_0x3e4e24[_0xc370('0x2d')],_0x19d411=_0x160a71['offset'],_0x1a0825=_0x160a71[_0xc370('0x2e')]+_0x160a71[_0xc370('0x2f')],_0x48a16b;if(_0x1a0825>=_0x3871d6){_0x1a0825=_0x3871d6;_0x48a16b=0xc8;}else{_0x48a16b=0xce;}_0x41ee86[_0xc370('0x2a')](_0x48a16b);return _0x41ee86[_0xc370('0x30')]('Content-Range',_0x19d411+'-'+_0x1a0825+'/'+_0x3871d6)['json'](_0x3e4e24);}return null;};}function patchUpdates(_0x25c8ee){return function(_0x1b5485){try{jsonpatch['apply'](_0x1b5485,_0x25c8ee,!![]);}catch(_0xb2b10b){return BPromise['reject'](_0xb2b10b);}return _0x1b5485[_0xc370('0x31')]();};}function saveUpdates(_0x2c9ad0,_0x54bf53){return function(_0x22be5e){if(_0x22be5e){return _0x22be5e['update'](_0x2c9ad0)['then'](function(_0x3caae3){return _0x3caae3;});}return null;};}function removeEntity(_0x5e9dde,_0x4addf1){return function(_0x34acfb){if(_0x34acfb){return _0x34acfb[_0xc370('0x32')]()[_0xc370('0x33')](function(){_0x5e9dde[_0xc370('0x2a')](0xcc)[_0xc370('0x2b')]();});}};}function handleEntityNotFound(_0x3f1eff,_0x3845ea){return function(_0x113cc5){if(!_0x113cc5){_0x3f1eff['sendStatus'](0x194);}return _0x113cc5;};}function handleError(_0x5d1665,_0x364bbf){_0x364bbf=_0x364bbf||0x1f4;return function(_0x42f6b9){logger[_0xc370('0x25')](_0x42f6b9['stack']);if(_0x42f6b9[_0xc370('0x34')]){delete _0x42f6b9[_0xc370('0x34')];}_0x5d1665['status'](_0x364bbf)[_0xc370('0x35')](_0x42f6b9);};}exports[_0xc370('0x36')]=function(_0x40c715,_0xbf9a2a){var _0x4ca0c4={},_0x5a84f3={},_0x2f6906={'count':0x0,'rows':[]};var _0x3dc665=_[_0xc370('0x37')](db['DeskConfiguration'][_0xc370('0x38')],function(_0x2b1f14){return{'name':_0x2b1f14[_0xc370('0x39')],'type':_0x2b1f14[_0xc370('0x3a')][_0xc370('0x3b')]};});_0x5a84f3['model']=_[_0xc370('0x37')](_0x3dc665,_0xc370('0x34'));_0x5a84f3[_0xc370('0x3c')]=_['keys'](_0x40c715[_0xc370('0x3c')]);_0x5a84f3['filters']=_[_0xc370('0x3d')](_0x5a84f3[_0xc370('0x3e')],_0x5a84f3[_0xc370('0x3c')]);_0x4ca0c4['attributes']=_[_0xc370('0x3d')](_0x5a84f3['model'],qs['fields'](_0x40c715['query'][_0xc370('0x3f')]));_0x4ca0c4['attributes']=_0x4ca0c4[_0xc370('0x40')][_0xc370('0x41')]?_0x4ca0c4[_0xc370('0x40')]:_0x5a84f3[_0xc370('0x3e')];if(!_0x40c715[_0xc370('0x3c')]['hasOwnProperty'](_0xc370('0x42'))){_0x4ca0c4[_0xc370('0x2f')]=qs['limit'](_0x40c715[_0xc370('0x3c')][_0xc370('0x2f')]);_0x4ca0c4['offset']=qs[_0xc370('0x2e')](_0x40c715[_0xc370('0x3c')][_0xc370('0x2e')]);}_0x4ca0c4[_0xc370('0x43')]=qs[_0xc370('0x44')](_0x40c715[_0xc370('0x3c')][_0xc370('0x44')]);_0x4ca0c4[_0xc370('0x45')]=qs[_0xc370('0x46')](_['pick'](_0x40c715[_0xc370('0x3c')],_0x5a84f3['filters']),_0x3dc665);if(_0x40c715[_0xc370('0x3c')][_0xc370('0x47')]){_0x4ca0c4[_0xc370('0x45')]=_[_0xc370('0x48')](_0x4ca0c4[_0xc370('0x45')],{'$or':_['map'](_0x3dc665,function(_0x1e09e4){if(_0x1e09e4[_0xc370('0x3a')]!==_0xc370('0x49')){var _0x2a2ca3={};_0x2a2ca3[_0x1e09e4[_0xc370('0x34')]]={'$like':'%'+_0x40c715[_0xc370('0x3c')][_0xc370('0x47')]+'%'};return _0x2a2ca3;}})});}_0x4ca0c4=_[_0xc370('0x48')]({},_0x4ca0c4,_0x40c715[_0xc370('0x4a')]);var _0x34949e={'where':_0x4ca0c4[_0xc370('0x45')]};return db[_0xc370('0x4b')][_0xc370('0x2d')](_0x34949e)[_0xc370('0x33')](function(_0x66ff6a){_0x2f6906[_0xc370('0x2d')]=_0x66ff6a;if(_0x40c715[_0xc370('0x3c')]['includeAll']){_0x4ca0c4[_0xc370('0x4c')]=[{'all':!![]}];}return db[_0xc370('0x4b')][_0xc370('0x4d')](_0x4ca0c4);})['then'](function(_0x16218e){_0x2f6906['rows']=_0x16218e;return _0x2f6906;})[_0xc370('0x33')](respondWithFilteredResult(_0xbf9a2a,_0x4ca0c4))[_0xc370('0x28')](handleError(_0xbf9a2a,null));};exports[_0xc370('0x4e')]=function(_0x346267,_0x5538b8){var _0x2439ba={'raw':![],'where':{'id':_0x346267[_0xc370('0x4f')]['id']}},_0x5542f9={};_0x5542f9['model']=_[_0xc370('0x50')](db[_0xc370('0x4b')][_0xc370('0x38')]);_0x5542f9[_0xc370('0x3c')]=_[_0xc370('0x50')](_0x346267[_0xc370('0x3c')]);_0x5542f9[_0xc370('0x46')]=_[_0xc370('0x3d')](_0x5542f9['model'],_0x5542f9[_0xc370('0x3c')]);_0x2439ba['attributes']=_[_0xc370('0x3d')](_0x5542f9[_0xc370('0x3e')],qs[_0xc370('0x3f')](_0x346267['query']['fields']));_0x2439ba[_0xc370('0x40')]=_0x2439ba[_0xc370('0x40')][_0xc370('0x41')]?_0x2439ba[_0xc370('0x40')]:_0x5542f9[_0xc370('0x3e')];if(_0x346267[_0xc370('0x3c')]['includeAll']){_0x2439ba[_0xc370('0x4c')]=[{'all':!![]}];}_0x2439ba=_['merge']({},_0x2439ba,_0x346267[_0xc370('0x4a')]);return db[_0xc370('0x4b')][_0xc370('0x51')](_0x2439ba)[_0xc370('0x33')](handleEntityNotFound(_0x5538b8,null))[_0xc370('0x33')](respondWithResult(_0x5538b8,null))[_0xc370('0x28')](handleError(_0x5538b8,null));};exports[_0xc370('0x52')]=function(_0x5babea,_0xe0b25e){return db['DeskConfiguration']['create'](_0x5babea[_0xc370('0x53')],{})[_0xc370('0x33')](respondWithResult(_0xe0b25e,0xc9))[_0xc370('0x28')](handleError(_0xe0b25e,null));};exports['update']=function(_0x45b758,_0x5ee6a1){if(_0x45b758[_0xc370('0x53')]['id']){delete _0x45b758[_0xc370('0x53')]['id'];}return db[_0xc370('0x4b')][_0xc370('0x51')]({'where':{'id':_0x45b758[_0xc370('0x4f')]['id']}})[_0xc370('0x33')](handleEntityNotFound(_0x5ee6a1,null))[_0xc370('0x33')](saveUpdates(_0x45b758['body'],null))['then'](respondWithResult(_0x5ee6a1,null))[_0xc370('0x28')](handleError(_0x5ee6a1,null));};exports[_0xc370('0x32')]=function(_0x56818e,_0x13cad6){return db[_0xc370('0x4b')]['find']({'where':{'id':_0x56818e[_0xc370('0x4f')]['id']}})[_0xc370('0x33')](handleEntityNotFound(_0x13cad6,null))[_0xc370('0x33')](removeEntity(_0x13cad6,null))[_0xc370('0x28')](handleError(_0x13cad6,null));};exports[_0xc370('0x54')]=function(_0x54b05f,_0x3df8cd,_0x228510){var _0x1668f1={};var _0x2cbf43={};var _0x4d7897;var _0x4c49cc;return db[_0xc370('0x4b')][_0xc370('0x55')]({'where':{'id':_0x54b05f['params']['id']}})[_0xc370('0x33')](handleEntityNotFound(_0x3df8cd,null))[_0xc370('0x33')](function(_0x2df23a){if(_0x2df23a){_0x4d7897=_0x2df23a;_0x2cbf43[_0xc370('0x3e')]=_[_0xc370('0x50')](db[_0xc370('0x56')][_0xc370('0x38')]);_0x2cbf43[_0xc370('0x3c')]=_['keys'](_0x54b05f['query']);_0x2cbf43[_0xc370('0x46')]=_[_0xc370('0x3d')](_0x2cbf43['model'],_0x2cbf43['query']);_0x1668f1['attributes']=_[_0xc370('0x3d')](_0x2cbf43[_0xc370('0x3e')],qs[_0xc370('0x3f')](_0x54b05f[_0xc370('0x3c')][_0xc370('0x3f')]));_0x1668f1[_0xc370('0x40')]=_0x1668f1[_0xc370('0x40')][_0xc370('0x41')]?_0x1668f1['attributes']:_0x2cbf43[_0xc370('0x3e')];_0x1668f1['order']=qs[_0xc370('0x44')](_0x54b05f[_0xc370('0x3c')][_0xc370('0x44')]);_0x1668f1[_0xc370('0x45')]=qs[_0xc370('0x46')](_[_0xc370('0x57')](_0x54b05f[_0xc370('0x3c')],_0x2cbf43[_0xc370('0x46')]));if(_0x54b05f[_0xc370('0x3c')][_0xc370('0x47')]){_0x1668f1[_0xc370('0x45')]=_[_0xc370('0x48')](_0x1668f1[_0xc370('0x45')],{'$or':_[_0xc370('0x37')](_0x1668f1[_0xc370('0x40')],function(_0x4aa08d){var _0x55c73c={};_0x55c73c[_0x4aa08d]={'$like':'%'+_0x54b05f[_0xc370('0x3c')][_0xc370('0x47')]+'%'};return _0x55c73c;})});}_0x1668f1=_[_0xc370('0x48')]({},_0x1668f1,_0x54b05f[_0xc370('0x4a')]);return _0x4d7897[_0xc370('0x54')](_0x1668f1);}})[_0xc370('0x33')](function(_0x1f6dd9){if(_0x1f6dd9){_0x4c49cc=_0x1f6dd9[_0xc370('0x41')];if(!_0x54b05f['query']['hasOwnProperty'](_0xc370('0x42'))){_0x1668f1['limit']=qs[_0xc370('0x2f')](_0x54b05f[_0xc370('0x3c')][_0xc370('0x2f')]);_0x1668f1[_0xc370('0x2e')]=qs[_0xc370('0x2e')](_0x54b05f[_0xc370('0x3c')][_0xc370('0x2e')]);}return _0x4d7897[_0xc370('0x54')](_0x1668f1);}})[_0xc370('0x33')](function(_0x5054d9){if(_0x5054d9){return _0x5054d9?{'count':_0x4c49cc,'rows':_0x5054d9}:null;}})[_0xc370('0x33')](respondWithResult(_0x3df8cd,null))['catch'](handleError(_0x3df8cd,null));};exports[_0xc370('0x58')]=function(_0x2911cc,_0x3f0026,_0x24b88e){var _0x5daf1a={};var _0x29cf90={};var _0x34fdb2;var _0x192475;return db[_0xc370('0x4b')]['findOne']({'where':{'id':_0x2911cc[_0xc370('0x4f')]['id']}})[_0xc370('0x33')](handleEntityNotFound(_0x3f0026,null))[_0xc370('0x33')](function(_0x1e4cd4){if(_0x1e4cd4){_0x34fdb2=_0x1e4cd4;_0x29cf90[_0xc370('0x3e')]=_['keys'](db[_0xc370('0x56')][_0xc370('0x38')]);_0x29cf90[_0xc370('0x3c')]=_[_0xc370('0x50')](_0x2911cc[_0xc370('0x3c')]);_0x29cf90['filters']=_[_0xc370('0x3d')](_0x29cf90[_0xc370('0x3e')],_0x29cf90[_0xc370('0x3c')]);_0x5daf1a['attributes']=_['intersection'](_0x29cf90['model'],qs[_0xc370('0x3f')](_0x2911cc[_0xc370('0x3c')][_0xc370('0x3f')]));_0x5daf1a[_0xc370('0x40')]=_0x5daf1a[_0xc370('0x40')][_0xc370('0x41')]?_0x5daf1a['attributes']:_0x29cf90[_0xc370('0x3e')];_0x5daf1a[_0xc370('0x43')]=qs[_0xc370('0x44')](_0x2911cc[_0xc370('0x3c')]['sort']);_0x5daf1a[_0xc370('0x45')]=qs[_0xc370('0x46')](_['pick'](_0x2911cc['query'],_0x29cf90[_0xc370('0x46')]));if(_0x2911cc[_0xc370('0x3c')][_0xc370('0x47')]){_0x5daf1a[_0xc370('0x45')]=_[_0xc370('0x48')](_0x5daf1a['where'],{'$or':_[_0xc370('0x37')](_0x5daf1a[_0xc370('0x40')],function(_0x4b9892){var _0x2f786c={};_0x2f786c[_0x4b9892]={'$like':'%'+_0x2911cc['query'][_0xc370('0x47')]+'%'};return _0x2f786c;})});}_0x5daf1a=_[_0xc370('0x48')]({},_0x5daf1a,_0x2911cc[_0xc370('0x4a')]);return _0x34fdb2[_0xc370('0x58')](_0x5daf1a);}})[_0xc370('0x33')](function(_0x4a449d){if(_0x4a449d){_0x192475=_0x4a449d[_0xc370('0x41')];if(!_0x2911cc[_0xc370('0x3c')][_0xc370('0x59')](_0xc370('0x42'))){_0x5daf1a[_0xc370('0x2f')]=qs['limit'](_0x2911cc[_0xc370('0x3c')][_0xc370('0x2f')]);_0x5daf1a['offset']=qs['offset'](_0x2911cc[_0xc370('0x3c')][_0xc370('0x2e')]);}return _0x34fdb2[_0xc370('0x58')](_0x5daf1a);}})[_0xc370('0x33')](function(_0x951a76){if(_0x951a76){return _0x951a76?{'count':_0x192475,'rows':_0x951a76}:null;}})[_0xc370('0x33')](respondWithResult(_0x3f0026,null))[_0xc370('0x28')](handleError(_0x3f0026,null));};exports[_0xc370('0x5a')]=function(_0x242935,_0x2df1c3,_0x20f72a){var _0x553841={};var _0xc39696={};var _0x452ba9;var _0x31f7bd;return db['DeskConfiguration'][_0xc370('0x55')]({'where':{'id':_0x242935[_0xc370('0x4f')]['id']}})[_0xc370('0x33')](handleEntityNotFound(_0x2df1c3,null))[_0xc370('0x33')](function(_0xe1ef81){if(_0xe1ef81){_0x452ba9=_0xe1ef81;_0xc39696[_0xc370('0x3e')]=_[_0xc370('0x50')](db[_0xc370('0x56')][_0xc370('0x38')]);_0xc39696['query']=_[_0xc370('0x50')](_0x242935[_0xc370('0x3c')]);_0xc39696[_0xc370('0x46')]=_[_0xc370('0x3d')](_0xc39696[_0xc370('0x3e')],_0xc39696['query']);_0x553841[_0xc370('0x40')]=_[_0xc370('0x3d')](_0xc39696['model'],qs[_0xc370('0x3f')](_0x242935[_0xc370('0x3c')]['fields']));_0x553841[_0xc370('0x40')]=_0x553841[_0xc370('0x40')][_0xc370('0x41')]?_0x553841[_0xc370('0x40')]:_0xc39696[_0xc370('0x3e')];_0x553841[_0xc370('0x43')]=qs[_0xc370('0x44')](_0x242935[_0xc370('0x3c')]['sort']);_0x553841[_0xc370('0x45')]=qs[_0xc370('0x46')](_[_0xc370('0x57')](_0x242935[_0xc370('0x3c')],_0xc39696[_0xc370('0x46')]));if(_0x242935[_0xc370('0x3c')][_0xc370('0x47')]){_0x553841[_0xc370('0x45')]=_[_0xc370('0x48')](_0x553841[_0xc370('0x45')],{'$or':_[_0xc370('0x37')](_0x553841[_0xc370('0x40')],function(_0x54d123){var _0x29b57a={};_0x29b57a[_0x54d123]={'$like':'%'+_0x242935['query']['filter']+'%'};return _0x29b57a;})});}_0x553841=_[_0xc370('0x48')]({},_0x553841,_0x242935[_0xc370('0x4a')]);return _0x452ba9[_0xc370('0x5a')](_0x553841);}})[_0xc370('0x33')](function(_0x268f5c){if(_0x268f5c){_0x31f7bd=_0x268f5c[_0xc370('0x41')];if(!_0x242935[_0xc370('0x3c')][_0xc370('0x59')](_0xc370('0x42'))){_0x553841[_0xc370('0x2f')]=qs[_0xc370('0x2f')](_0x242935['query'][_0xc370('0x2f')]);_0x553841[_0xc370('0x2e')]=qs[_0xc370('0x2e')](_0x242935['query'][_0xc370('0x2e')]);}return _0x452ba9[_0xc370('0x5a')](_0x553841);}})[_0xc370('0x33')](function(_0x2a11c6){if(_0x2a11c6){return _0x2a11c6?{'count':_0x31f7bd,'rows':_0x2a11c6}:null;}})['then'](respondWithResult(_0x2df1c3,null))[_0xc370('0x28')](handleError(_0x2df1c3,null));};exports[_0xc370('0x5b')]=function(_0x41fa63,_0x3ca1ca,_0x142e68){var _0x47f421={};var _0x1ec7de={};var _0x236565;var _0x4dfd93;return db[_0xc370('0x4b')][_0xc370('0x55')]({'where':{'id':_0x41fa63[_0xc370('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3ca1ca,null))[_0xc370('0x33')](function(_0x4f0958){if(_0x4f0958){_0x236565=_0x4f0958;_0x1ec7de[_0xc370('0x3e')]=_[_0xc370('0x50')](db[_0xc370('0x5c')][_0xc370('0x38')]);_0x1ec7de[_0xc370('0x3c')]=_[_0xc370('0x50')](_0x41fa63[_0xc370('0x3c')]);_0x1ec7de[_0xc370('0x46')]=_['intersection'](_0x1ec7de[_0xc370('0x3e')],_0x1ec7de[_0xc370('0x3c')]);_0x47f421[_0xc370('0x40')]=_[_0xc370('0x3d')](_0x1ec7de['model'],qs['fields'](_0x41fa63[_0xc370('0x3c')][_0xc370('0x3f')]));_0x47f421[_0xc370('0x40')]=_0x47f421[_0xc370('0x40')][_0xc370('0x41')]?_0x47f421['attributes']:_0x1ec7de[_0xc370('0x3e')];_0x47f421[_0xc370('0x43')]=qs[_0xc370('0x44')](_0x41fa63[_0xc370('0x3c')][_0xc370('0x44')]);_0x47f421[_0xc370('0x45')]=qs[_0xc370('0x46')](_[_0xc370('0x57')](_0x41fa63[_0xc370('0x3c')],_0x1ec7de[_0xc370('0x46')]));if(_0x41fa63[_0xc370('0x3c')]['filter']){_0x47f421['where']=_[_0xc370('0x48')](_0x47f421['where'],{'$or':_[_0xc370('0x37')](_0x47f421['attributes'],function(_0x114b37){var _0x35fc46={};_0x35fc46[_0x114b37]={'$like':'%'+_0x41fa63[_0xc370('0x3c')][_0xc370('0x47')]+'%'};return _0x35fc46;})});}_0x47f421=_[_0xc370('0x48')]({},_0x47f421,_0x41fa63['options']);return _0x236565['getTags'](_0x47f421);}})['then'](function(_0x4877a8){if(_0x4877a8){_0x4dfd93=_0x4877a8[_0xc370('0x41')];if(!_0x41fa63['query'][_0xc370('0x59')](_0xc370('0x42'))){_0x47f421[_0xc370('0x2f')]=qs[_0xc370('0x2f')](_0x41fa63['query']['limit']);_0x47f421[_0xc370('0x2e')]=qs['offset'](_0x41fa63[_0xc370('0x3c')]['offset']);}return _0x236565['getTags'](_0x47f421);}})[_0xc370('0x33')](function(_0x537f7d){if(_0x537f7d){return _0x537f7d?{'count':_0x4dfd93,'rows':_0x537f7d}:null;}})[_0xc370('0x33')](respondWithResult(_0x3ca1ca,null))[_0xc370('0x28')](handleError(_0x3ca1ca,null));};exports[_0xc370('0x5d')]=function(_0x3d6259,_0x45cef4,_0x47920b){if(_0x3d6259['body']['id']){delete _0x3d6259[_0xc370('0x53')]['id'];}return db[_0xc370('0x4b')][_0xc370('0x55')]({'where':{'id':_0x3d6259[_0xc370('0x4f')]['id']}})[_0xc370('0x33')](handleEntityNotFound(_0x45cef4,null))[_0xc370('0x33')](function(_0x31d99e){if(_0x31d99e){return _0x31d99e[_0xc370('0x5d')](_0x3d6259['body']['ids']||[]);}return null;})[_0xc370('0x33')](respondWithResult(_0x45cef4,null))[_0xc370('0x28')](handleError(_0x45cef4,null));};
\ No newline at end of file