Built motion from commit de2cb856.|2.0.33
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.model.js
1 var _0x919b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x62\x6C\x75\x65\x62\x69\x72\x64","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72","\x2E\x2F\x76\x6F\x69\x63\x65\x43\x68\x61\x6E\x53\x70\x79\x2E\x61\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x73\x79\x73\x74\x65\x6D","\x25\x73\x25\x73","\x70\x72\x65\x66\x69\x78","\x66\x6F\x72\x6D\x61\x74","\x69\x64","\x72\x65\x63\x6F\x72\x64","\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x24\x7B\x55\x4E\x49\x51\x55\x45\x49\x44\x7D\x2E\x25\x73","\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x46\x6F\x72\x6D\x61\x74","\x6D\x65\x72\x67\x65","\x70\x75\x73\x68","\x61\x75\x74\x68","\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x43\x68\x61\x6E\x53\x70\x79","\x53\x49\x50\x2F\x25\x73\x2C\x25\x73","\x6F\x70\x74\x69\x6F\x6E\x73","","\x6A\x6F\x69\x6E","\x53\x74\x6F\x70\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x6C\x65\x6E\x67\x74\x68","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x6E\x61\x6D\x65","\x63\x6F\x6E\x63\x61\x74","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x61\x67\x65\x6E\x74","\x66\x69\x6E\x64\x41\x6C\x6C","\x55\x73\x65\x72","\x65\x78\x70\x6F\x72\x74\x73","\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x43\x68\x61\x6E\x53\x70\x79","\x76\x6F\x69\x63\x65\x5F\x63\x68\x61\x6E\x73\x70\x79","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x66\x69\x6E\x65"];_0x919b[0];var _=require(_0x919b[1]);var util=require(_0x919b[2]);var BPromise=require(_0x919b[3]);var logger=require(_0x919b[5])(_0x919b[4]);var attributes=require(_0x919b[6]);var getUserApplications=function(_0x95f4x7,_0x95f4x8,_0x95f4x9){var _0x95f4xa=1;var _0x95f4xb=[];var _0x95f4xc={context:_0x919b[7],type:_0x919b[8],isApp:false};var _0x95f4xd={exten:util[_0x919b[11]](_0x919b[9],_0x95f4x7[_0x919b[10]],_0x95f4x9),ChanSpyId:_0x95f4x7[_0x919b[12]],UserId:_0x95f4x8[_0x919b[12]]};if(_0x95f4x7[_0x919b[13]]){_0x95f4xb[_0x919b[18]](_[_0x919b[17]]({app:_0x919b[14],appdata:util[_0x919b[11]](_0x919b[15],_0x95f4x7[_0x919b[16]]),priority:_0x95f4xa++},_0x95f4xc,_0x95f4xd))};if(_0x95f4x7[_0x919b[19]]){_0x95f4xb[_0x919b[18]](_[_0x919b[17]]({app:_0x919b[20],appdata:_0x95f4x7[_0x919b[21]],priority:_0x95f4xa++},_0x95f4xc,_0x95f4xd))};_0x95f4xb[_0x919b[18]](_[_0x919b[17]]({app:_0x919b[22],appdata:util[_0x919b[11]](_0x919b[23],_0x95f4x9,_0x95f4x7[_0x919b[24]]?_0x95f4x7[_0x919b[24]][_0x919b[26]](_0x919b[25]):null),priority:_0x95f4xa++},_0x95f4xc,_0x95f4xd));if(_0x95f4x7[_0x919b[13]]){_0x95f4xb[_0x919b[18]](_[_0x919b[17]]({app:_0x919b[27],priority:_0x95f4xa++},_0x95f4xc,_0x95f4xd))};return _0x95f4xb};var getChanSpyApplications=function(_0x95f4x7,_0x95f4xf){var _0x95f4xb=[];for(var _0x95f4x10=0,_0x95f4xa=1;_0x95f4x10< _0x95f4xf[_0x919b[28]];_0x95f4x10++,_0x95f4xa= 1){var _0x95f4x11=getUserApplications(_0x95f4x7,_0x95f4xf[_0x95f4x10],_0x95f4xf[_0x95f4x10][_0x919b[29]]);var _0x95f4x12=getUserApplications(_0x95f4x7,_0x95f4xf[_0x95f4x10],_0x95f4xf[_0x95f4x10][_0x919b[30]]);_0x95f4xb= _0x95f4xb[_0x919b[31]](_0x95f4x11,_0x95f4x12)};return _0x95f4xb};var getChanSpyPromise=function(_0x95f4x14,_0x95f4x7){return  new BPromise(function(_0x95f4x15,_0x95f4x16){return _0x95f4x14[_0x919b[36]][_0x919b[35]]({attributes:[_0x919b[12],_0x919b[30],_0x919b[29]],where:{role:_0x919b[34],chanspy:true},raw:true})[_0x919b[33]](function(_0x95f4x18){if(_0x95f4x18){return _0x95f4x15(getChanSpyApplications(_0x95f4x7,_0x95f4x18))};return _0x95f4x15([])})[_0x919b[32]](function(_0x95f4x17){_0x95f4x16(_0x95f4x17)})})};module[_0x919b[37]]= function(_0x95f4x19,_0x95f4x1a){var _0x95f4x14=_0x95f4x19[_0x919b[38]];return _0x95f4x19[_0x919b[44]](_0x919b[39],attributes,{tableName:_0x919b[40],paranoid:false,indexes:[],timestamps:true,hooks:{afterCreate:function(_0x95f4x1b,_0x95f4x1c,_0x95f4x1d){return getChanSpyPromise(_0x95f4x14,_0x95f4x1b)[_0x919b[33]](function(_0x95f4xb){if(_0x95f4xb&& _0x95f4xb[_0x919b[28]]){return _0x95f4x14[_0x919b[42]][_0x919b[41]](_0x95f4xb)}})[_0x919b[33]](function(){_0x95f4x1d()})[_0x919b[32]](function(_0x95f4x17){_0x95f4x1d(_0x95f4x17)})},afterUpdate:function(_0x95f4x1b,_0x95f4x1c,_0x95f4x1d){return _0x95f4x14[_0x919b[42]][_0x919b[43]]({where:{ChanSpyId:_0x95f4x1b[_0x919b[12]]}})[_0x919b[33]](function(){return getChanSpyPromise(_0x95f4x14,_0x95f4x1b)})[_0x919b[33]](function(_0x95f4xb){if(_0x95f4xb&& _0x95f4xb[_0x919b[28]]){return _0x95f4x14[_0x919b[42]][_0x919b[41]](_0x95f4xb)}})[_0x919b[33]](function(){_0x95f4x1d()})[_0x919b[32]](function(_0x95f4x17){_0x95f4x1d(_0x95f4x17)})},afterDestroy:function(_0x95f4x1b,_0x95f4x1c,_0x95f4x1d){return _0x95f4x14[_0x919b[42]][_0x919b[43]]({where:{ChanSpyId:_0x95f4x1b[_0x919b[12]]}})[_0x919b[33]](function(){_0x95f4x1d()})[_0x919b[32]](function(_0x95f4x17){_0x95f4x1d(_0x95f4x17)})}}})}