Built motion from commit 67e5df37.|2.0.60
[motion2.git] / server / api / tag / tag.controller.js
index 536c7da..6447ce0 100644 (file)
@@ -1 +1 @@
-var _0xc4f3=["\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","\x74\x6F\x2D\x63\x73\x76","\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","\x71\x75\x65\x72\x79\x73\x74\x72\x69\x6E\x67","\x70\x61\x70\x61\x70\x61\x72\x73\x65","\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","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x63\x6F\x75\x6E\x74","\x6F\x66\x66\x73\x65\x74","\x6C\x69\x6D\x69\x74","\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","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72","\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","\x54\x61\x67","\x6B\x65\x79\x73","\x64\x61\x74\x65\x53\x74\x61\x72\x74","\x71\x75\x65\x72\x79","\x64\x61\x74\x65\x45\x6E\x64","\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","\x64\x61\x79","\x61\x64\x64","\x6D\x65\x72\x67\x65","\x66\x69\x6C\x74\x65\x72","\x25","\x6D\x61\x70","\x6F\x70\x74\x69\x6F\x6E\x73","\x63\x61\x74\x63\x68","\x72\x6F\x77\x73","\x69\x6E\x63\x6C\x75\x64\x65\x41\x6C\x6C","\x69\x6E\x63\x6C\x75\x64\x65","\x66\x69\x6E\x64\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"];_0xc4f3[0];var jsonpatch=require(_0xc4f3[1]);var rp=require(_0xc4f3[2]);var moment=require(_0xc4f3[3]);var BPromise=require(_0xc4f3[4]);var Mustache=require(_0xc4f3[5]);var util=require(_0xc4f3[6]);var path=require(_0xc4f3[7]);var sox=require(_0xc4f3[8]);var csv=require(_0xc4f3[9]);var ejs=require(_0xc4f3[10]);var fs=require(_0xc4f3[11]);var _=require(_0xc4f3[12]);var squel=require(_0xc4f3[13]);var crypto=require(_0xc4f3[14]);var jsforce=require(_0xc4f3[15]);var deskjs=require(_0xc4f3[16]);var toCsv=require(_0xc4f3[9]);var querystring=require(_0xc4f3[17]);var Papa=require(_0xc4f3[18]);var qs=require(_0xc4f3[19]);var logger=require(_0xc4f3[21])(_0xc4f3[20]);var utils=require(_0xc4f3[22]);var config=require(_0xc4f3[23]);var db=require(_0xc4f3[25])[_0xc4f3[24]];function respondWithStatusCode(_0xbb57x1a,_0xbb57x1b){_0xbb57x1b= _0xbb57x1b|| 204;return function(_0xbb57x1c){if(_0xbb57x1c){return _0xbb57x1a[_0xc4f3[26]](_0xbb57x1b)};return _0xbb57x1a[_0xc4f3[28]](_0xbb57x1b)[_0xc4f3[27]]()}}function respondWithResult(_0xbb57x1a,_0xbb57x1b){_0xbb57x1b= _0xbb57x1b|| 200;return function(_0xbb57x1c){if(_0xbb57x1c){return _0xbb57x1a[_0xc4f3[28]](_0xbb57x1b)[_0xc4f3[29]](_0xbb57x1c)}}}function respondWithFilteredResult(_0xbb57x1a,_0xbb57x1f){return function(_0xbb57x1c){if(_0xbb57x1c){var _0xbb57x20=_0xbb57x1c[_0xc4f3[30]],_0xbb57x21=_0xbb57x1f[_0xc4f3[31]],_0xbb57x22=_0xbb57x1f[_0xc4f3[31]]+ _0xbb57x1f[_0xc4f3[32]],_0xbb57x1b;if(_0xbb57x22>= _0xbb57x20){_0xbb57x22= _0xbb57x20;_0xbb57x1b= 200}else {_0xbb57x1b= 206};_0xbb57x1a[_0xc4f3[28]](_0xbb57x1b);return _0xbb57x1a[_0xc4f3[36]](_0xc4f3[33],_0xbb57x21+ _0xc4f3[34]+ _0xbb57x22+ _0xc4f3[35]+ _0xbb57x20)[_0xc4f3[29]](_0xbb57x1c)};return null}}function patchUpdates(_0xbb57x24){return function(_0xbb57x1c){try{jsonpatch[_0xc4f3[37]](_0xbb57x1c,_0xbb57x24,true)}catch(err){return BPromise[_0xc4f3[38]](err)};return _0xbb57x1c[_0xc4f3[39]]()}}function saveUpdates(_0xbb57x26,_0xbb57x1b){return function(_0xbb57x1c){if(_0xbb57x1c){return _0xbb57x1c[_0xc4f3[41]](_0xbb57x26)[_0xc4f3[40]](function(_0xbb57x27){return _0xbb57x27})};return null}}function removeEntity(_0xbb57x1a,_0xbb57x1b){return function(_0xbb57x1c){if(_0xbb57x1c){return _0xbb57x1c[_0xc4f3[42]]()[_0xc4f3[40]](function(){_0xbb57x1a[_0xc4f3[28]](204)[_0xc4f3[27]]()})}}}function handleEntityNotFound(_0xbb57x1a,_0xbb57x1b){return function(_0xbb57x1c){if(!_0xbb57x1c){_0xbb57x1a[_0xc4f3[26]](404)};return _0xbb57x1c}}function handleError(_0xbb57x1a,_0xbb57x1b){_0xbb57x1b= _0xbb57x1b|| 500;return function(_0xbb57x2b){logger[_0xc4f3[44]](_0xbb57x2b[_0xc4f3[43]]);if(_0xbb57x2b[_0xc4f3[45]]){delete _0xbb57x2b[_0xc4f3[45]]};_0xbb57x1a[_0xc4f3[28]](_0xbb57x1b)[_0xc4f3[46]](_0xbb57x2b)}}exports[_0xc4f3[47]]= function(_0xbb57x2c,_0xbb57x1a){var _0xbb57x1f={},_0xbb57x2d={},_0xbb57x2e={count:0,rows:[]};_0xbb57x2d[_0xc4f3[48]]= _[_0xc4f3[51]](db[_0xc4f3[50]][_0xc4f3[49]]);var _0xbb57x2f={dateStart:_0xbb57x2c[_0xc4f3[53]][_0xc4f3[52]],dateEnd:_0xbb57x2c[_0xc4f3[53]][_0xc4f3[54]]};delete _0xbb57x2c[_0xc4f3[53]][_0xc4f3[52]];delete _0xbb57x2c[_0xc4f3[53]][_0xc4f3[54]];_0xbb57x2d[_0xc4f3[53]]= _[_0xc4f3[51]](_0xbb57x2c[_0xc4f3[53]]);_0xbb57x2d[_0xc4f3[55]]= _[_0xc4f3[56]](_0xbb57x2d[_0xc4f3[48]],_0xbb57x2d[_0xc4f3[53]]);_0xbb57x1f[_0xc4f3[57]]= _[_0xc4f3[56]](_0xbb57x2d[_0xc4f3[48]],qs[_0xc4f3[58]](_0xbb57x2c[_0xc4f3[53]][_0xc4f3[58]]));_0xbb57x1f[_0xc4f3[57]]= (_0xbb57x1f[_0xc4f3[57]][_0xc4f3[59]])?_0xbb57x1f[_0xc4f3[57]]:_0xbb57x2d[_0xc4f3[48]];if(!_0xbb57x2c[_0xc4f3[53]][_0xc4f3[61]](_0xc4f3[60])){_0xbb57x1f[_0xc4f3[32]]= qs[_0xc4f3[32]](_0xbb57x2c[_0xc4f3[53]][_0xc4f3[32]]);_0xbb57x1f[_0xc4f3[31]]= qs[_0xc4f3[31]](_0xbb57x2c[_0xc4f3[53]][_0xc4f3[31]])};_0xbb57x1f[_0xc4f3[62]]= qs[_0xc4f3[63]](_0xbb57x2c[_0xc4f3[53]][_0xc4f3[63]]);_0xbb57x1f[_0xc4f3[64]]= qs[_0xc4f3[55]](_[_0xc4f3[65]](_0xbb57x2c[_0xc4f3[53]],_0xbb57x2d[_0xc4f3[55]]));if(_0xbb57x2f[_0xc4f3[52]]){if(_0xbb57x2f[_0xc4f3[54]]){_0xbb57x2f[_0xc4f3[54]]= moment(_0xbb57x2f[_0xc4f3[54]])[_0xc4f3[67]](1,_0xc4f3[66])}else {_0xbb57x2f[_0xc4f3[54]]= moment(_0xbb57x2f[_0xc4f3[52]])[_0xc4f3[67]](1,_0xc4f3[66])};_[_0xc4f3[68]](_0xbb57x1f[_0xc4f3[64]],{createdAt:{$gte:_0xbb57x2f[_0xc4f3[52]],$lte:_0xbb57x2f[_0xc4f3[54]]}})};if(_0xbb57x2c[_0xc4f3[53]][_0xc4f3[69]]){_0xbb57x1f[_0xc4f3[64]]= _[_0xc4f3[68]](_0xbb57x1f[_0xc4f3[64]],{$or:_[_0xc4f3[71]](_0xbb57x1f[_0xc4f3[57]],function(_0xbb57x30){var _0xbb57x2e={};_0xbb57x2e[_0xbb57x30]= {$like:_0xc4f3[70]+ _0xbb57x2c[_0xc4f3[53]][_0xc4f3[69]]+ _0xc4f3[70]};return _0xbb57x2e})})};_0xbb57x1f= _[_0xc4f3[68]]({},_0xbb57x1f,_0xbb57x2c[_0xc4f3[72]]);var _0xbb57x31={where:_0xbb57x1f[_0xc4f3[64]]};return db[_0xc4f3[50]][_0xc4f3[30]](_0xbb57x31)[_0xc4f3[40]](function(_0xbb57x20){_0xbb57x2e[_0xc4f3[30]]= _0xbb57x20;if(_0xbb57x2c[_0xc4f3[53]][_0xc4f3[75]]){_0xbb57x1f[_0xc4f3[76]]= [{all:true}]};return db[_0xc4f3[50]][_0xc4f3[77]](_0xbb57x1f)})[_0xc4f3[40]](function(_0xbb57x32){_0xbb57x2e[_0xc4f3[74]]= _0xbb57x32;return _0xbb57x2e})[_0xc4f3[40]](respondWithFilteredResult(_0xbb57x1a,_0xbb57x1f))[_0xc4f3[73]](handleError(_0xbb57x1a,null))};exports[_0xc4f3[78]]= function(_0xbb57x2c,_0xbb57x1a){var _0xbb57x1f={raw:true,where:{id:_0xbb57x2c[_0xc4f3[80]][_0xc4f3[79]]}},_0xbb57x2d={};_0xbb57x2d[_0xc4f3[48]]= _[_0xc4f3[51]](db[_0xc4f3[50]][_0xc4f3[49]]);_0xbb57x2d[_0xc4f3[53]]= _[_0xc4f3[51]](_0xbb57x2c[_0xc4f3[53]]);_0xbb57x2d[_0xc4f3[55]]= _[_0xc4f3[56]](_0xbb57x2d[_0xc4f3[48]],_0xbb57x2d[_0xc4f3[53]]);_0xbb57x1f[_0xc4f3[57]]= _[_0xc4f3[56]](_0xbb57x2d[_0xc4f3[48]],qs[_0xc4f3[58]](_0xbb57x2c[_0xc4f3[53]][_0xc4f3[58]]));_0xbb57x1f[_0xc4f3[57]]= (_0xbb57x1f[_0xc4f3[57]][_0xc4f3[59]])?_0xbb57x1f[_0xc4f3[57]]:_0xbb57x2d[_0xc4f3[48]];if(_0xbb57x2c[_0xc4f3[53]][_0xc4f3[75]]){_0xbb57x1f[_0xc4f3[76]]= [{all:true}]};_0xbb57x1f= _[_0xc4f3[68]]({},_0xbb57x1f,_0xbb57x2c[_0xc4f3[72]]);return db[_0xc4f3[50]][_0xc4f3[81]](_0xbb57x1f)[_0xc4f3[40]](handleEntityNotFound(_0xbb57x1a,null))[_0xc4f3[40]](respondWithResult(_0xbb57x1a,null))[_0xc4f3[73]](handleError(_0xbb57x1a,null))};exports[_0xc4f3[82]]= function(_0xbb57x2c,_0xbb57x1a){return db[_0xc4f3[50]][_0xc4f3[82]](_0xbb57x2c[_0xc4f3[83]],{})[_0xc4f3[40]](respondWithResult(_0xbb57x1a,201))[_0xc4f3[73]](handleError(_0xbb57x1a,null))};exports[_0xc4f3[41]]= function(_0xbb57x2c,_0xbb57x1a){if(_0xbb57x2c[_0xc4f3[83]][_0xc4f3[79]]){delete _0xbb57x2c[_0xc4f3[83]][_0xc4f3[79]]};return db[_0xc4f3[50]][_0xc4f3[81]]({where:{id:_0xbb57x2c[_0xc4f3[80]][_0xc4f3[79]]}})[_0xc4f3[40]](handleEntityNotFound(_0xbb57x1a,null))[_0xc4f3[40]](saveUpdates(_0xbb57x2c[_0xc4f3[83]],null))[_0xc4f3[40]](respondWithResult(_0xbb57x1a,null))[_0xc4f3[73]](handleError(_0xbb57x1a,null))};exports[_0xc4f3[42]]= function(_0xbb57x2c,_0xbb57x1a){return db[_0xc4f3[50]][_0xc4f3[81]]({where:{id:_0xbb57x2c[_0xc4f3[80]][_0xc4f3[79]]}})[_0xc4f3[40]](handleEntityNotFound(_0xbb57x1a,null))[_0xc4f3[40]](removeEntity(_0xbb57x1a,null))[_0xc4f3[73]](handleError(_0xbb57x1a,null))}
\ No newline at end of file
+var _0x394a=["\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","\x74\x6F\x2D\x63\x73\x76","\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","\x71\x75\x65\x72\x79\x73\x74\x72\x69\x6E\x67","\x70\x61\x70\x61\x70\x61\x72\x73\x65","\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","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x63\x6F\x75\x6E\x74","\x6F\x66\x66\x73\x65\x74","\x6C\x69\x6D\x69\x74","\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","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72","\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","\x54\x61\x67","\x6B\x65\x79\x73","\x64\x61\x74\x65\x53\x74\x61\x72\x74","\x71\x75\x65\x72\x79","\x64\x61\x74\x65\x45\x6E\x64","\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","\x64\x61\x79","\x61\x64\x64","\x6D\x65\x72\x67\x65","\x66\x69\x6C\x74\x65\x72","\x25","\x6D\x61\x70","\x6F\x70\x74\x69\x6F\x6E\x73","\x63\x61\x74\x63\x68","\x72\x6F\x77\x73","\x69\x6E\x63\x6C\x75\x64\x65\x41\x6C\x6C","\x69\x6E\x63\x6C\x75\x64\x65","\x66\x69\x6E\x64\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"];_0x394a[0];var jsonpatch=require(_0x394a[1]);var rp=require(_0x394a[2]);var moment=require(_0x394a[3]);var BPromise=require(_0x394a[4]);var Mustache=require(_0x394a[5]);var util=require(_0x394a[6]);var path=require(_0x394a[7]);var sox=require(_0x394a[8]);var csv=require(_0x394a[9]);var ejs=require(_0x394a[10]);var fs=require(_0x394a[11]);var _=require(_0x394a[12]);var squel=require(_0x394a[13]);var crypto=require(_0x394a[14]);var jsforce=require(_0x394a[15]);var deskjs=require(_0x394a[16]);var toCsv=require(_0x394a[9]);var querystring=require(_0x394a[17]);var Papa=require(_0x394a[18]);var qs=require(_0x394a[19]);var logger=require(_0x394a[21])(_0x394a[20]);var utils=require(_0x394a[22]);var config=require(_0x394a[23]);var db=require(_0x394a[25])[_0x394a[24]];function respondWithStatusCode(_0x53f8x1a,_0x53f8x1b){_0x53f8x1b= _0x53f8x1b|| 204;return function(_0x53f8x1c){if(_0x53f8x1c){return _0x53f8x1a[_0x394a[26]](_0x53f8x1b)};return _0x53f8x1a[_0x394a[28]](_0x53f8x1b)[_0x394a[27]]()}}function respondWithResult(_0x53f8x1a,_0x53f8x1b){_0x53f8x1b= _0x53f8x1b|| 200;return function(_0x53f8x1c){if(_0x53f8x1c){return _0x53f8x1a[_0x394a[28]](_0x53f8x1b)[_0x394a[29]](_0x53f8x1c)}}}function respondWithFilteredResult(_0x53f8x1a,_0x53f8x1f){return function(_0x53f8x1c){if(_0x53f8x1c){var _0x53f8x20=_0x53f8x1c[_0x394a[30]],_0x53f8x21=_0x53f8x1f[_0x394a[31]],_0x53f8x22=_0x53f8x1f[_0x394a[31]]+ _0x53f8x1f[_0x394a[32]],_0x53f8x1b;if(_0x53f8x22>= _0x53f8x20){_0x53f8x22= _0x53f8x20;_0x53f8x1b= 200}else {_0x53f8x1b= 206};_0x53f8x1a[_0x394a[28]](_0x53f8x1b);return _0x53f8x1a[_0x394a[36]](_0x394a[33],_0x53f8x21+ _0x394a[34]+ _0x53f8x22+ _0x394a[35]+ _0x53f8x20)[_0x394a[29]](_0x53f8x1c)};return null}}function patchUpdates(_0x53f8x24){return function(_0x53f8x1c){try{jsonpatch[_0x394a[37]](_0x53f8x1c,_0x53f8x24,true)}catch(err){return BPromise[_0x394a[38]](err)};return _0x53f8x1c[_0x394a[39]]()}}function saveUpdates(_0x53f8x26,_0x53f8x1b){return function(_0x53f8x1c){if(_0x53f8x1c){return _0x53f8x1c[_0x394a[41]](_0x53f8x26)[_0x394a[40]](function(_0x53f8x27){return _0x53f8x27})};return null}}function removeEntity(_0x53f8x1a,_0x53f8x1b){return function(_0x53f8x1c){if(_0x53f8x1c){return _0x53f8x1c[_0x394a[42]]()[_0x394a[40]](function(){_0x53f8x1a[_0x394a[28]](204)[_0x394a[27]]()})}}}function handleEntityNotFound(_0x53f8x1a,_0x53f8x1b){return function(_0x53f8x1c){if(!_0x53f8x1c){_0x53f8x1a[_0x394a[26]](404)};return _0x53f8x1c}}function handleError(_0x53f8x1a,_0x53f8x1b){_0x53f8x1b= _0x53f8x1b|| 500;return function(_0x53f8x2b){logger[_0x394a[44]](_0x53f8x2b[_0x394a[43]]);if(_0x53f8x2b[_0x394a[45]]){delete _0x53f8x2b[_0x394a[45]]};_0x53f8x1a[_0x394a[28]](_0x53f8x1b)[_0x394a[46]](_0x53f8x2b)}}exports[_0x394a[47]]= function(_0x53f8x2c,_0x53f8x1a){var _0x53f8x1f={},_0x53f8x2d={},_0x53f8x2e={count:0,rows:[]};_0x53f8x2d[_0x394a[48]]= _[_0x394a[51]](db[_0x394a[50]][_0x394a[49]]);var _0x53f8x2f={dateStart:_0x53f8x2c[_0x394a[53]][_0x394a[52]],dateEnd:_0x53f8x2c[_0x394a[53]][_0x394a[54]]};delete _0x53f8x2c[_0x394a[53]][_0x394a[52]];delete _0x53f8x2c[_0x394a[53]][_0x394a[54]];_0x53f8x2d[_0x394a[53]]= _[_0x394a[51]](_0x53f8x2c[_0x394a[53]]);_0x53f8x2d[_0x394a[55]]= _[_0x394a[56]](_0x53f8x2d[_0x394a[48]],_0x53f8x2d[_0x394a[53]]);_0x53f8x1f[_0x394a[57]]= _[_0x394a[56]](_0x53f8x2d[_0x394a[48]],qs[_0x394a[58]](_0x53f8x2c[_0x394a[53]][_0x394a[58]]));_0x53f8x1f[_0x394a[57]]= (_0x53f8x1f[_0x394a[57]][_0x394a[59]])?_0x53f8x1f[_0x394a[57]]:_0x53f8x2d[_0x394a[48]];if(!_0x53f8x2c[_0x394a[53]][_0x394a[61]](_0x394a[60])){_0x53f8x1f[_0x394a[32]]= qs[_0x394a[32]](_0x53f8x2c[_0x394a[53]][_0x394a[32]]);_0x53f8x1f[_0x394a[31]]= qs[_0x394a[31]](_0x53f8x2c[_0x394a[53]][_0x394a[31]])};_0x53f8x1f[_0x394a[62]]= qs[_0x394a[63]](_0x53f8x2c[_0x394a[53]][_0x394a[63]]);_0x53f8x1f[_0x394a[64]]= qs[_0x394a[55]](_[_0x394a[65]](_0x53f8x2c[_0x394a[53]],_0x53f8x2d[_0x394a[55]]));if(_0x53f8x2f[_0x394a[52]]){if(_0x53f8x2f[_0x394a[54]]){_0x53f8x2f[_0x394a[54]]= moment(_0x53f8x2f[_0x394a[54]])[_0x394a[67]](1,_0x394a[66])}else {_0x53f8x2f[_0x394a[54]]= moment(_0x53f8x2f[_0x394a[52]])[_0x394a[67]](1,_0x394a[66])};_[_0x394a[68]](_0x53f8x1f[_0x394a[64]],{createdAt:{$gte:_0x53f8x2f[_0x394a[52]],$lte:_0x53f8x2f[_0x394a[54]]}})};if(_0x53f8x2c[_0x394a[53]][_0x394a[69]]){_0x53f8x1f[_0x394a[64]]= _[_0x394a[68]](_0x53f8x1f[_0x394a[64]],{$or:_[_0x394a[71]](_0x53f8x1f[_0x394a[57]],function(_0x53f8x30){var _0x53f8x2e={};_0x53f8x2e[_0x53f8x30]= {$like:_0x394a[70]+ _0x53f8x2c[_0x394a[53]][_0x394a[69]]+ _0x394a[70]};return _0x53f8x2e})})};_0x53f8x1f= _[_0x394a[68]]({},_0x53f8x1f,_0x53f8x2c[_0x394a[72]]);var _0x53f8x31={where:_0x53f8x1f[_0x394a[64]]};return db[_0x394a[50]][_0x394a[30]](_0x53f8x31)[_0x394a[40]](function(_0x53f8x20){_0x53f8x2e[_0x394a[30]]= _0x53f8x20;if(_0x53f8x2c[_0x394a[53]][_0x394a[75]]){_0x53f8x1f[_0x394a[76]]= [{all:true}]};return db[_0x394a[50]][_0x394a[77]](_0x53f8x1f)})[_0x394a[40]](function(_0x53f8x32){_0x53f8x2e[_0x394a[74]]= _0x53f8x32;return _0x53f8x2e})[_0x394a[40]](respondWithFilteredResult(_0x53f8x1a,_0x53f8x1f))[_0x394a[73]](handleError(_0x53f8x1a,null))};exports[_0x394a[78]]= function(_0x53f8x2c,_0x53f8x1a){var _0x53f8x1f={raw:true,where:{id:_0x53f8x2c[_0x394a[80]][_0x394a[79]]}},_0x53f8x2d={};_0x53f8x2d[_0x394a[48]]= _[_0x394a[51]](db[_0x394a[50]][_0x394a[49]]);_0x53f8x2d[_0x394a[53]]= _[_0x394a[51]](_0x53f8x2c[_0x394a[53]]);_0x53f8x2d[_0x394a[55]]= _[_0x394a[56]](_0x53f8x2d[_0x394a[48]],_0x53f8x2d[_0x394a[53]]);_0x53f8x1f[_0x394a[57]]= _[_0x394a[56]](_0x53f8x2d[_0x394a[48]],qs[_0x394a[58]](_0x53f8x2c[_0x394a[53]][_0x394a[58]]));_0x53f8x1f[_0x394a[57]]= (_0x53f8x1f[_0x394a[57]][_0x394a[59]])?_0x53f8x1f[_0x394a[57]]:_0x53f8x2d[_0x394a[48]];if(_0x53f8x2c[_0x394a[53]][_0x394a[75]]){_0x53f8x1f[_0x394a[76]]= [{all:true}]};_0x53f8x1f= _[_0x394a[68]]({},_0x53f8x1f,_0x53f8x2c[_0x394a[72]]);return db[_0x394a[50]][_0x394a[81]](_0x53f8x1f)[_0x394a[40]](handleEntityNotFound(_0x53f8x1a,null))[_0x394a[40]](respondWithResult(_0x53f8x1a,null))[_0x394a[73]](handleError(_0x53f8x1a,null))};exports[_0x394a[82]]= function(_0x53f8x2c,_0x53f8x1a){return db[_0x394a[50]][_0x394a[82]](_0x53f8x2c[_0x394a[83]],{})[_0x394a[40]](respondWithResult(_0x53f8x1a,201))[_0x394a[73]](handleError(_0x53f8x1a,null))};exports[_0x394a[41]]= function(_0x53f8x2c,_0x53f8x1a){if(_0x53f8x2c[_0x394a[83]][_0x394a[79]]){delete _0x53f8x2c[_0x394a[83]][_0x394a[79]]};return db[_0x394a[50]][_0x394a[81]]({where:{id:_0x53f8x2c[_0x394a[80]][_0x394a[79]]}})[_0x394a[40]](handleEntityNotFound(_0x53f8x1a,null))[_0x394a[40]](saveUpdates(_0x53f8x2c[_0x394a[83]],null))[_0x394a[40]](respondWithResult(_0x53f8x1a,null))[_0x394a[73]](handleError(_0x53f8x1a,null))};exports[_0x394a[42]]= function(_0x53f8x2c,_0x53f8x1a){return db[_0x394a[50]][_0x394a[81]]({where:{id:_0x53f8x2c[_0x394a[80]][_0x394a[79]]}})[_0x394a[40]](handleEntityNotFound(_0x53f8x1a,null))[_0x394a[40]](removeEntity(_0x53f8x1a,null))[_0x394a[73]](handleError(_0x53f8x1a,null))}
\ No newline at end of file