Built motion from commit 42b6453.|2.0.28
[motion2.git] / server / api / chatQueue / chatQueue.controller.js
1 var _0xf584=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x61\x73\x74\x2D\x6A\x73\x6F\x6E\x2D\x70\x61\x74\x63\x68","\x72\x65\x71\x75\x65\x73\x74\x2D\x70\x72\x6F\x6D\x69\x73\x65","\x6D\x6F\x6D\x65\x6E\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6D\x75\x73\x74\x61\x63\x68\x65","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x73\x6F\x78","\x65\x6A\x73","\x66\x73","\x6C\x6F\x64\x61\x73\x68","\x73\x71\x75\x65\x6C","\x63\x72\x79\x70\x74\x6F","\x6A\x73\x66\x6F\x72\x63\x65","\x64\x65\x73\x6B\x2E\x6A\x73","\x74\x6F\x2D\x63\x73\x76","\x71\x75\x65\x72\x79\x73\x74\x72\x69\x6E\x67","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73\x2F\x70\x61\x72\x73\x65\x72\x73\x2F\x71\x73","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x64\x62","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x79\x73\x71\x6C\x64\x62","\x43\x68\x61\x74\x51\x75\x65\x75\x65\x2C\x20\x25\x73\x2C\x20\x25\x73\x2C\x20\x25\x73","\x6E\x6F\x20\x63\x6F\x6E\x74\x65\x6E\x74","\x69\x6E\x66\x6F","\x43\x68\x61\x74\x51\x75\x65\x75\x65\x2C\x20\x25\x73\x2C\x20\x25\x73\x2C\x20\x25\x73\x2C\x20\x25\x73","\x64\x65\x62\x75\x67","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x65\x6E\x74\x69\x74\x79\x20\x66\x6F\x75\x6E\x64","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x6A\x73\x6F\x6E","\x63\x6F\x75\x6E\x74","\x6F\x66\x66\x73\x65\x74","\x6C\x69\x6D\x69\x74","\x65\x6E\x74\x69\x74\x69\x65\x73\x20\x66\x6F\x75\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x52\x61\x6E\x67\x65","\x2D","\x2F","\x73\x65\x74","\x61\x70\x70\x6C\x79","\x72\x65\x6A\x65\x63\x74","\x73\x61\x76\x65","\x65\x6E\x74\x69\x74\x79\x20\x75\x70\x64\x61\x74\x65\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65","\x65\x6E\x74\x69\x74\x79\x20\x72\x65\x6D\x6F\x76\x65\x64","\x64\x65\x73\x74\x72\x6F\x79","\x65\x6E\x74\x69\x74\x79\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x65\x72\x72\x6F\x72","\x69\x6E\x73\x70\x65\x63\x74","\x6E\x61\x6D\x65","\x73\x65\x6E\x64","\x69\x6E\x64\x65\x78","\x6D\x6F\x64\x65\x6C","\x72\x61\x77\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x6B\x65\x79\x73","\x71\x75\x65\x72\x79","\x66\x69\x6C\x74\x65\x72\x73","\x69\x6E\x74\x65\x72\x73\x65\x63\x74\x69\x6F\x6E","\x61\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x66\x69\x65\x6C\x64\x73","\x6C\x65\x6E\x67\x74\x68","\x6E\x6F\x6C\x69\x6D\x69\x74","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x6F\x72\x64\x65\x72","\x73\x6F\x72\x74","\x77\x68\x65\x72\x65","\x70\x69\x63\x6B","\x66\x69\x6C\x74\x65\x72","\x25","\x6D\x61\x70","\x6D\x65\x72\x67\x65","\x6F\x70\x74\x69\x6F\x6E\x73","\x63\x61\x74\x63\x68","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x67\x65\x74\x54\x65\x61\x6D\x73","\x54\x65\x61\x6D","\x66\x69\x6E\x64\x4F\x6E\x65","\x61\x64\x64\x54\x65\x61\x6D\x73","\x69\x64\x73","\x70\x65\x6E\x61\x6C\x74\x79","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x41\x67\x65\x6E\x74\x73","\x75\x6E\x69\x6F\x6E","\x55\x73\x65\x72","\x66\x69\x6E\x64\x41\x6C\x6C","\x72\x65\x6D\x6F\x76\x65\x54\x65\x61\x6D\x73","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x6F\x6D\x69\x74","\x67\x65\x74\x41\x67\x65\x6E\x74\x73"];_0xf584[0];var jsonpatch=require(_0xf584[1]);var rp=require(_0xf584[2]);var moment=require(_0xf584[3]);var BPromise=require(_0xf584[4]);var Mustache=require(_0xf584[5]);var util=require(_0xf584[6]);var path=require(_0xf584[7]);var sox=require(_0xf584[8]);var ejs=require(_0xf584[9]);var fs=require(_0xf584[10]);var _=require(_0xf584[11]);var squel=require(_0xf584[12]);var crypto=require(_0xf584[13]);var jsforce=require(_0xf584[14]);var deskjs=require(_0xf584[15]);var toCsv=require(_0xf584[16]);var querystring=require(_0xf584[17]);var qs=require(_0xf584[18]);var logger=require(_0xf584[20])(_0xf584[19]);var utils=require(_0xf584[21]);var config=require(_0xf584[22]);var db=require(_0xf584[24])[_0xf584[23]];function respondWithStatusCode(_0x3620x18,_0x3620x19,_0x3620x1a){_0x3620x19= _0x3620x19|| 204;return function(_0x3620x1b){if(_0x3620x1b){logger[_0xf584[27]](_0xf584[25],_0x3620x1a,_0x3620x19,_0xf584[26]);logger[_0xf584[29]](_0xf584[28],_0x3620x1a,_0x3620x19,_0xf584[26]);return _0x3620x18[_0xf584[30]](_0x3620x19)};return _0x3620x18[_0xf584[32]](304)[_0xf584[31]]()}}function respondWithResult(_0x3620x18,_0x3620x19,_0x3620x1a){_0x3620x19= _0x3620x19|| 200;return function(_0x3620x1b){if(_0x3620x1b){logger[_0xf584[27]](_0xf584[25],_0x3620x1a,_0x3620x19,_0xf584[33]);logger[_0xf584[29]](_0xf584[28],_0x3620x1a,_0x3620x19,_0xf584[33],JSON[_0xf584[34]](_0x3620x1b));return _0x3620x18[_0xf584[32]](_0x3620x19)[_0xf584[35]](_0x3620x1b)};return _0x3620x18[_0xf584[32]](304)[_0xf584[31]]()}}function respondWithFilteredResult(_0x3620x18,_0x3620x1e,_0x3620x1a){return function(_0x3620x1b){if(_0x3620x1b){var _0x3620x1f=_0x3620x1b[_0xf584[36]],_0x3620x20=_0x3620x1e[_0xf584[37]],_0x3620x21=_0x3620x1e[_0xf584[37]]+ _0x3620x1e[_0xf584[38]],_0x3620x19;if(_0x3620x21>= _0x3620x1f){_0x3620x21= _0x3620x1f;_0x3620x19= 200}else {_0x3620x19= 206};_0x3620x18[_0xf584[32]](_0x3620x19);logger[_0xf584[27]](_0xf584[25],_0x3620x1a,_0x3620x19,_0xf584[39]);logger[_0xf584[29]](_0xf584[28],_0x3620x1a,_0x3620x19,_0xf584[33],JSON[_0xf584[34]](_0x3620x1b));return _0x3620x18[_0xf584[43]](_0xf584[40],_0x3620x20+ _0xf584[41]+ _0x3620x21+ _0xf584[42]+ _0x3620x1f)[_0xf584[35]](_0x3620x1b)};return null}}function patchUpdates(_0x3620x23){return function(_0x3620x1b){try{jsonpatch[_0xf584[44]](_0x3620x1b,_0x3620x23,true)}catch(err){return BPromise[_0xf584[45]](err)};return _0x3620x1b[_0xf584[46]]()}}function saveUpdates(_0x3620x25,_0x3620x19,_0x3620x1a){return function(_0x3620x1b){if(_0x3620x1b){return _0x3620x1b[_0xf584[49]](_0x3620x25)[_0xf584[48]](function(_0x3620x26){logger[_0xf584[27]](_0xf584[25],_0x3620x1a,_0x3620x19,_0xf584[47]);logger[_0xf584[29]](_0xf584[28],_0x3620x1a,_0x3620x19,_0xf584[47],JSON[_0xf584[34]](_0x3620x1b));return _0x3620x26})};return null}}function removeEntity(_0x3620x18,_0x3620x19,_0x3620x1a){return function(_0x3620x1b){if(_0x3620x1b){return _0x3620x1b[_0xf584[51]]()[_0xf584[48]](function(){logger[_0xf584[27]](_0xf584[25],_0x3620x1a,_0x3620x19,_0xf584[50]);logger[_0xf584[29]](_0xf584[28],_0x3620x1a,_0x3620x19,_0xf584[50],JSON[_0xf584[34]](_0x3620x1b));_0x3620x18[_0xf584[32]](204)[_0xf584[31]]()})}}}function handleEntityNotFound(_0x3620x18,_0x3620x19,_0x3620x1a){return function(_0x3620x1b){if(!_0x3620x1b){logger[_0xf584[53]](_0xf584[25],_0x3620x1a,404,_0xf584[52]);return _0x3620x18[_0xf584[30]](404)};return _0x3620x1b}}function handleError(_0x3620x18,_0x3620x19,_0x3620x1a){_0x3620x19= _0x3620x19|| 500;return function(_0x3620x2a){logger[_0xf584[53]](_0xf584[25],_0x3620x1a,_0x3620x19,util[_0xf584[54]](_0x3620x2a,{showHidden:false,depth:null}));delete _0x3620x2a[_0xf584[55]];_0x3620x18[_0xf584[32]](_0x3620x19)[_0xf584[56]](_0x3620x2a)}}exports[_0xf584[57]]= function(_0x3620x2b,_0x3620x18){var _0x3620x1e={},_0x3620x2c={};_0x3620x2c[_0xf584[58]]= _[_0xf584[61]](db[_0xf584[60]][_0xf584[59]]);_0x3620x2c[_0xf584[62]]= _[_0xf584[61]](_0x3620x2b[_0xf584[62]]);_0x3620x2c[_0xf584[63]]= _[_0xf584[64]](_0x3620x2c[_0xf584[58]],_0x3620x2c[_0xf584[62]]);_0x3620x1e[_0xf584[65]]= _[_0xf584[64]](_0x3620x2c[_0xf584[58]],qs[_0xf584[66]](_0x3620x2b[_0xf584[62]][_0xf584[66]]));_0x3620x1e[_0xf584[65]]= (_0x3620x1e[_0xf584[65]][_0xf584[67]])?_0x3620x1e[_0xf584[65]]:_0x3620x2c[_0xf584[58]];if(!_0x3620x2b[_0xf584[62]][_0xf584[69]](_0xf584[68])){_0x3620x1e[_0xf584[38]]= qs[_0xf584[38]](_0x3620x2b[_0xf584[62]][_0xf584[38]]);_0x3620x1e[_0xf584[37]]= qs[_0xf584[37]](_0x3620x2b[_0xf584[62]][_0xf584[37]])};_0x3620x1e[_0xf584[70]]= qs[_0xf584[71]](_0x3620x2b[_0xf584[62]][_0xf584[71]]);_0x3620x1e[_0xf584[72]]= qs[_0xf584[63]](_[_0xf584[73]](_0x3620x2b[_0xf584[62]],_0x3620x2c[_0xf584[63]]));if(_0x3620x2b[_0xf584[62]][_0xf584[74]]){_0x3620x1e[_0xf584[72]]= _[_0xf584[77]](_0x3620x1e[_0xf584[72]],{$or:_[_0xf584[76]](_0x3620x1e[_0xf584[65]],function(_0x3620x2d){var _0x3620x2e={};_0x3620x2e[_0x3620x2d]= {$like:_0xf584[75]+ _0x3620x2b[_0xf584[62]][_0xf584[74]]+ _0xf584[75]};return _0x3620x2e})})};_0x3620x1e= _[_0xf584[77]]({},_0x3620x1e,_0x3620x2b[_0xf584[78]]);return db[_0xf584[60]][_0xf584[80]](_0x3620x1e)[_0xf584[48]](respondWithFilteredResult(_0x3620x18,_0x3620x1e,_0xf584[57]))[_0xf584[79]](handleError(_0x3620x18,null,_0xf584[57]))};exports[_0xf584[81]]= function(_0x3620x2b,_0x3620x18){var _0x3620x1e={raw:true,where:{id:_0x3620x2b[_0xf584[83]][_0xf584[82]]}},_0x3620x2c={};_0x3620x2c[_0xf584[58]]= _[_0xf584[61]](db[_0xf584[60]][_0xf584[59]]);_0x3620x2c[_0xf584[62]]= _[_0xf584[61]](_0x3620x2b[_0xf584[62]]);_0x3620x2c[_0xf584[63]]= _[_0xf584[64]](_0x3620x2c[_0xf584[58]],_0x3620x2c[_0xf584[62]]);_0x3620x1e[_0xf584[65]]= _[_0xf584[64]](_0x3620x2c[_0xf584[58]],qs[_0xf584[66]](_0x3620x2b[_0xf584[62]][_0xf584[66]]));_0x3620x1e[_0xf584[65]]= (_0x3620x1e[_0xf584[65]][_0xf584[67]])?_0x3620x1e[_0xf584[65]]:_0x3620x2c[_0xf584[58]];_0x3620x1e= _[_0xf584[77]]({},_0x3620x1e,_0x3620x2b[_0xf584[78]]);return db[_0xf584[60]][_0xf584[84]](_0x3620x1e)[_0xf584[48]](handleEntityNotFound(_0x3620x18,null,_0xf584[81]))[_0xf584[48]](respondWithResult(_0x3620x18,null,_0xf584[81]))[_0xf584[79]](handleError(_0x3620x18,null,_0xf584[81]))};exports[_0xf584[85]]= function(_0x3620x2b,_0x3620x18){return db[_0xf584[60]][_0xf584[85]](_0x3620x2b[_0xf584[86]],{})[_0xf584[48]](respondWithResult(_0x3620x18,201,_0xf584[85]))[_0xf584[79]](handleError(_0x3620x18,null,_0xf584[85]))};exports[_0xf584[49]]= function(_0x3620x2b,_0x3620x18){if(_0x3620x2b[_0xf584[86]][_0xf584[82]]){delete _0x3620x2b[_0xf584[86]][_0xf584[82]]};return db[_0xf584[60]][_0xf584[84]]({where:{id:_0x3620x2b[_0xf584[83]][_0xf584[82]]}})[_0xf584[48]](handleEntityNotFound(_0x3620x18,null,_0xf584[49]))[_0xf584[48]](saveUpdates(_0x3620x2b[_0xf584[86]],null,_0xf584[49]))[_0xf584[48]](respondWithResult(_0x3620x18,null,_0xf584[49]))[_0xf584[79]](handleError(_0x3620x18,null,_0xf584[49]))};exports[_0xf584[51]]= function(_0x3620x2b,_0x3620x18){return db[_0xf584[60]][_0xf584[84]]({where:{id:_0x3620x2b[_0xf584[83]][_0xf584[82]]}})[_0xf584[48]](handleEntityNotFound(_0x3620x18,null,_0xf584[51]))[_0xf584[48]](removeEntity(_0x3620x18,null,_0xf584[51]))[_0xf584[79]](handleError(_0x3620x18,null,_0xf584[51]))};exports[_0xf584[87]]= function(_0x3620x2b,_0x3620x1b,_0x3620x2f){var _0x3620x1e={};var _0x3620x2c={};var _0x3620x30;var _0x3620x1f;return db[_0xf584[60]][_0xf584[89]]({where:{id:_0x3620x2b[_0xf584[83]][_0xf584[82]]}})[_0xf584[48]](handleEntityNotFound(_0x3620x1b,null,_0xf584[87]))[_0xf584[48]](function(_0x3620x1b){if(_0x3620x1b){_0x3620x30= _0x3620x1b;_0x3620x2c[_0xf584[58]]= _[_0xf584[61]](db[_0xf584[88]][_0xf584[59]]);_0x3620x2c[_0xf584[62]]= _[_0xf584[61]](_0x3620x2b[_0xf584[62]]);_0x3620x2c[_0xf584[63]]= _[_0xf584[64]](_0x3620x2c[_0xf584[58]],_0x3620x2c[_0xf584[62]]);_0x3620x1e[_0xf584[65]]= _[_0xf584[64]](_0x3620x2c[_0xf584[58]],qs[_0xf584[66]](_0x3620x2b[_0xf584[62]][_0xf584[66]]));_0x3620x1e[_0xf584[65]]= (_0x3620x1e[_0xf584[65]][_0xf584[67]])?_0x3620x1e[_0xf584[65]]:_0x3620x2c[_0xf584[58]];_0x3620x1e[_0xf584[70]]= qs[_0xf584[71]](_0x3620x2b[_0xf584[62]][_0xf584[71]]);_0x3620x1e[_0xf584[72]]= qs[_0xf584[63]](_[_0xf584[73]](_0x3620x2b[_0xf584[62]],_0x3620x2c[_0xf584[63]]));if(_0x3620x2b[_0xf584[62]][_0xf584[74]]){_0x3620x1e[_0xf584[72]]= _[_0xf584[77]](_0x3620x1e[_0xf584[72]],{$or:_[_0xf584[76]](_0x3620x1e[_0xf584[65]],function(_0x3620x2d){var _0x3620x2e={};_0x3620x2e[_0x3620x2d]= {$like:_0xf584[75]+ _0x3620x2b[_0xf584[62]][_0xf584[74]]+ _0xf584[75]};return _0x3620x2e})})};_0x3620x1e= _[_0xf584[77]]({},_0x3620x1e,_0x3620x2b[_0xf584[78]]);return _0x3620x30[_0xf584[87]](_0x3620x1e)}})[_0xf584[48]](function(_0x3620x32){if(_0x3620x32){_0x3620x1f= _0x3620x32[_0xf584[67]];if(!_0x3620x2b[_0xf584[62]][_0xf584[69]](_0xf584[68])){_0x3620x1e[_0xf584[38]]= qs[_0xf584[38]](_0x3620x2b[_0xf584[62]][_0xf584[38]]);_0x3620x1e[_0xf584[37]]= qs[_0xf584[37]](_0x3620x2b[_0xf584[62]][_0xf584[37]])};return _0x3620x30[_0xf584[87]](_0x3620x1e)}})[_0xf584[48]](function(_0x3620x31){return _0x3620x31?{count:_0x3620x1f,rows:_0x3620x31}:null})[_0xf584[48]](respondWithResult(_0x3620x1b,null,_0xf584[87]))[_0xf584[79]](handleError(_0x3620x1b,null,_0xf584[87]))};exports[_0xf584[90]]= function(_0x3620x2b,_0x3620x18,_0x3620x2f){var _0x3620x33=[];var _0x3620x34;return db[_0xf584[88]][_0xf584[97]]({where:{id:_0x3620x2b[_0xf584[86]][_0xf584[91]]},attributes:[_0xf584[82]],include:[{model:db[_0xf584[96]],as:_0xf584[94],attributes:[_0xf584[82]],raw:true}]})[_0xf584[48]](function(_0x3620x37){if(_0x3620x37){for(var _0x3620x38=0;_0x3620x38< _0x3620x37[_0xf584[67]];_0x3620x38+= 1){for(var _0x3620x39=0;_0x3620x39< _0x3620x37[_0x3620x38][_0xf584[94]][_0xf584[67]];_0x3620x39+= 1){_0x3620x33= _[_0xf584[95]](_0x3620x33,[_0x3620x37[_0x3620x38][_0xf584[94]][_0x3620x39][_0xf584[82]]])}};return _0x3620x33}})[_0xf584[48]](function(_0x3620x36){if(_0x3620x36){return db[_0xf584[60]][_0xf584[84]]({where:{id:_0x3620x2b[_0xf584[83]][_0xf584[82]]}})}})[_0xf584[48]](function(_0x3620x35){if(_0x3620x35){_0x3620x34= _0x3620x35;return _0x3620x34[_0xf584[93]](_0x3620x33,{penalty:_0x3620x2b[_0xf584[86]][_0xf584[92]]})}})[_0xf584[48]](function(_0x3620x1b){if(_0x3620x1b){return _0x3620x34[_0xf584[90]](_0x3620x2b[_0xf584[86]][_0xf584[91]])}})[_0xf584[48]](handleEntityNotFound(_0x3620x18,null,_0xf584[90]))[_0xf584[48]](respondWithStatusCode(_0x3620x18,null,_0xf584[90]))[_0xf584[79]](handleError(_0x3620x18,null,_0xf584[90]))};exports[_0xf584[98]]= function(_0x3620x2b,_0x3620x18,_0x3620x2f){var _0x3620x33=[];var _0x3620x34;return db[_0xf584[88]][_0xf584[97]]({where:{id:_0x3620x2b[_0xf584[62]][_0xf584[91]]},attributes:[_0xf584[82]],include:[{model:db[_0xf584[96]],as:_0xf584[94],attributes:[_0xf584[82]],raw:true}]})[_0xf584[48]](function(_0x3620x37){if(_0x3620x37){for(var _0x3620x38=0;_0x3620x38< _0x3620x37[_0xf584[67]];_0x3620x38+= 1){for(var _0x3620x39=0;_0x3620x39< _0x3620x37[_0x3620x38][_0xf584[94]][_0xf584[67]];_0x3620x39+= 1){_0x3620x33= _[_0xf584[95]](_0x3620x33,[_0x3620x37[_0x3620x38][_0xf584[94]][_0x3620x39][_0xf584[82]]])}};return _0x3620x33}})[_0xf584[48]](function(_0x3620x36){if(_0x3620x36){return db[_0xf584[60]][_0xf584[84]]({where:{id:_0x3620x2b[_0xf584[83]][_0xf584[82]]}})}})[_0xf584[48]](function(_0x3620x35){if(_0x3620x35){_0x3620x34= _0x3620x35;return _0x3620x34[_0xf584[99]](_0x3620x33)}})[_0xf584[48]](function(_0x3620x1b){if(_0x3620x34){return _0x3620x34[_0xf584[98]](_0x3620x2b[_0xf584[62]][_0xf584[91]])}})[_0xf584[48]](handleEntityNotFound(_0x3620x18,null,_0xf584[98]))[_0xf584[48]](respondWithStatusCode(_0x3620x18,null,_0xf584[98]))[_0xf584[79]](handleError(_0x3620x18,null,_0xf584[98]))};exports[_0xf584[93]]= function(_0x3620x2b,_0x3620x18,_0x3620x2f){return db[_0xf584[60]][_0xf584[84]]({where:{id:_0x3620x2b[_0xf584[83]][_0xf584[82]]}})[_0xf584[48]](handleEntityNotFound(_0x3620x18,null,_0xf584[93]))[_0xf584[48]](function(_0x3620x1b){if(_0x3620x1b){return _0x3620x1b[_0xf584[93]](_0x3620x2b[_0xf584[86]][_0xf584[91]],_[_0xf584[100]](_0x3620x2b[_0xf584[86]],[_0xf584[91],_0xf584[82]])|| {})};return null})[_0xf584[48]](respondWithResult(_0x3620x18,null,_0xf584[93]))[_0xf584[79]](handleError(_0x3620x18,null,_0xf584[93]))};exports[_0xf584[99]]= function(_0x3620x2b,_0x3620x18,_0x3620x2f){var _0x3620x32;return db[_0xf584[60]][_0xf584[84]]({where:{id:_0x3620x2b[_0xf584[83]][_0xf584[82]]}})[_0xf584[48]](handleEntityNotFound(_0x3620x18,null,_0xf584[99]))[_0xf584[48]](function(_0x3620x1b){if(_0x3620x1b){return _0x3620x1b[_0xf584[99]](_0x3620x2b[_0xf584[62]][_0xf584[91]])}})[_0xf584[48]](respondWithStatusCode(_0x3620x18,null,_0xf584[99]))[_0xf584[79]](handleError(_0x3620x18,null,_0xf584[99]))};exports[_0xf584[101]]= function(_0x3620x2b,_0x3620x1b,_0x3620x2f){var _0x3620x1e={};var _0x3620x2c={};var _0x3620x30;var _0x3620x1f;return db[_0xf584[60]][_0xf584[89]]({where:{id:_0x3620x2b[_0xf584[83]][_0xf584[82]]}})[_0xf584[48]](handleEntityNotFound(_0x3620x1b,null,_0xf584[101]))[_0xf584[48]](function(_0x3620x1b){if(_0x3620x1b){_0x3620x30= _0x3620x1b;_0x3620x2c[_0xf584[58]]= _[_0xf584[61]](db[_0xf584[96]][_0xf584[59]]);_0x3620x2c[_0xf584[62]]= _[_0xf584[61]](_0x3620x2b[_0xf584[62]]);_0x3620x2c[_0xf584[63]]= _[_0xf584[64]](_0x3620x2c[_0xf584[58]],_0x3620x2c[_0xf584[62]]);_0x3620x1e[_0xf584[65]]= _[_0xf584[64]](_0x3620x2c[_0xf584[58]],qs[_0xf584[66]](_0x3620x2b[_0xf584[62]][_0xf584[66]]));_0x3620x1e[_0xf584[65]]= (_0x3620x1e[_0xf584[65]][_0xf584[67]])?_0x3620x1e[_0xf584[65]]:_0x3620x2c[_0xf584[58]];_0x3620x1e[_0xf584[70]]= qs[_0xf584[71]](_0x3620x2b[_0xf584[62]][_0xf584[71]]);_0x3620x1e[_0xf584[72]]= qs[_0xf584[63]](_[_0xf584[73]](_0x3620x2b[_0xf584[62]],_0x3620x2c[_0xf584[63]]));if(_0x3620x2b[_0xf584[62]][_0xf584[74]]){_0x3620x1e[_0xf584[72]]= _[_0xf584[77]](_0x3620x1e[_0xf584[72]],{$or:_[_0xf584[76]](_0x3620x1e[_0xf584[65]],function(_0x3620x2d){var _0x3620x2e={};_0x3620x2e[_0x3620x2d]= {$like:_0xf584[75]+ _0x3620x2b[_0xf584[62]][_0xf584[74]]+ _0xf584[75]};return _0x3620x2e})})};_0x3620x1e= _[_0xf584[77]]({},_0x3620x1e,_0x3620x2b[_0xf584[78]]);return _0x3620x30[_0xf584[101]](_0x3620x1e)}})[_0xf584[48]](function(_0x3620x32){if(_0x3620x32){_0x3620x1f= _0x3620x32[_0xf584[67]];if(!_0x3620x2b[_0xf584[62]][_0xf584[69]](_0xf584[68])){_0x3620x1e[_0xf584[38]]= qs[_0xf584[38]](_0x3620x2b[_0xf584[62]][_0xf584[38]]);_0x3620x1e[_0xf584[37]]= qs[_0xf584[37]](_0x3620x2b[_0xf584[62]][_0xf584[37]])};return _0x3620x30[_0xf584[101]](_0x3620x1e)}})[_0xf584[48]](function(_0x3620x31){return _0x3620x31?{count:_0x3620x1f,rows:_0x3620x31}:null})[_0xf584[48]](respondWithResult(_0x3620x1b,null,_0xf584[101]))[_0xf584[79]](handleError(_0x3620x1b,null,_0xf584[101]))}