Built motion from commit 16f801c.|1.0.17
[motion.git] / server / api / openchannel_room / openchannel_room.controller.js
1 var _0xc423=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x6D\x6F\x6D\x65\x6E\x74","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x52\x6F\x6F\x6D","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x51\x75\x65\x75\x65","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x55\x73\x65\x72","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x64\x65\x66\x61\x75\x6C\x74","\x61\x67\x65\x6E\x74","\x69\x64","\x75\x73\x65\x72","\x73\x63\x6F\x70\x65","\x72\x6F\x6C\x65","\x64\x65\x73\x63\x72\x69\x62\x65","\x6D\x61\x70","\x67\x65\x74\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x51\x75\x65\x75\x65\x73\x49\x64\x42\x79\x55\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x70\x65\x6E\x64\x69\x6E\x67","\x6C\x6F\x67","\x50\x45\x4E\x44\x49\x4E\x47","\x64\x61\x79","\x73\x74\x61\x72\x74\x4F\x66","\x6D\x65\x72\x67\x65","\x63\x6F\x75\x6E\x74","\x61\x6C\x6C","\x6E\x65\x77","\x4E\x45\x57","\x6F\x70\x65\x6E","\x4F\x50\x45\x4E","\x63\x6C\x6F\x73\x65\x64","\x43\x4C\x4F\x53\x45\x44","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x70\x61\x72\x61\x6D\x73","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x67\x65\x74\x52\x6F\x6F\x6D\x42\x79\x4D\x65\x73\x73\x61\x67\x65","\x65\x72\x72","\x67\x65\x74\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x52\x6F\x6F\x6D","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x4D\x65\x73\x73\x61\x67\x65","\x55\x73\x65\x72\x49\x64","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x52\x6F\x6F\x6D\x49\x64","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74\x73","\x73\x65\x74\x55\x73\x65\x72\x73","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x67\x65\x74\x44\x61\x73\x68\x62\x6F\x61\x72\x64\x56\x61\x6C\x75\x65\x73","\x6B\x65\x79\x42\x79","\x6D\x61\x70\x56\x61\x6C\x75\x65\x73","\x53\x45\x4C\x45\x43\x54\x20\x4C\x4F\x57\x45\x52\x28\x73\x74\x61\x74\x75\x73\x29\x20\x41\x53\x20\x73\x74\x61\x74\x75\x73\x2C\x20\x43\x4F\x55\x4E\x54\x28\x69\x64\x29\x20\x41\x53\x20\x63\x6F\x75\x6E\x74\x20\x46\x52\x4F\x4D\x20\x6F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x5F\x72\x6F\x6F\x6D\x73\x20\x47\x52\x4F\x55\x50\x20\x42\x59\x20\x73\x74\x61\x74\x75\x73","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x75\x70\x64\x61\x74\x65\x50\x61\x74\x63\x68","\x2C","\x73\x70\x6C\x69\x74"];_0xc423[0];var _=require(_0xc423[1]);var Util=require(_0xc423[2]);var sequelize=require(_0xc423[4])[_0xc423[3]];var moment=require(_0xc423[5]);var OpenchannelRoom=require(_0xc423[4])[_0xc423[6]];var OpenchannelMessage=require(_0xc423[4])[_0xc423[7]];var OpenchannelAccount=require(_0xc423[4])[_0xc423[8]];var OpenchannelQueue=require(_0xc423[4])[_0xc423[9]];var OpenchannelApplication=require(_0xc423[4])[_0xc423[10]];var User=require(_0xc423[4])[_0xc423[11]];function handleError(_0x59f1xc,_0x59f1xd){return _0x59f1xc[_0xc423[13]](500)[_0xc423[12]](_0x59f1xd)}exports[_0xc423[14]]= function(_0x59f1xe,_0x59f1xc){switch(_0x59f1xe[_0xc423[23]][_0xc423[25]]){case _0xc423[21]:return OpenchannelRoom[_0xc423[24]](_0xc423[20],{method:[_0xc423[21],_0x59f1xe[_0xc423[23]][_0xc423[22]]]})[_0xc423[19]](Util[_0xc423[18]](_0x59f1xe[_0xc423[17]]))[_0xc423[16]](function(_0x59f1xf){return _0x59f1xc[_0xc423[13]](200)[_0xc423[12]](_0x59f1xf)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)});default:return OpenchannelRoom[_0xc423[24]](_0xc423[20])[_0xc423[19]](Util[_0xc423[18]](_0x59f1xe[_0xc423[17]]))[_0xc423[16]](function(_0x59f1xf){return _0x59f1xc[_0xc423[13]](200)[_0xc423[12]](_0x59f1xf)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)})}};exports[_0xc423[26]]= function(_0x59f1xe,_0x59f1xc){return OpenchannelRoom[_0xc423[26]]()[_0xc423[16]](function(_0x59f1x10){return _0x59f1xc[_0xc423[13]](200)[_0xc423[12]](_0x59f1x10)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)})};function getOpenchannelQueues(_0x59f1x12){return function(){switch(_0x59f1x12[_0xc423[25]]){case _0xc423[23]:return User[_0xc423[29]](_0x59f1x12[_0xc423[22]],{attributes:[_0xc423[22]]})[_0xc423[16]](Util[_0xc423[28]]({},{attributes:[_0xc423[22]],include:[{raw:true,model:User,attributes:[_0xc423[22]]}]}))[_0xc423[16]](function(_0x59f1x13){return {include:{model:OpenchannelAccount,include:{model:OpenchannelApplication,include:{model:OpenchannelQueue,where:{id:_[_0xc423[27]](_0x59f1x13,_0xc423[22])}}}}}});default:return {}}}}exports[_0xc423[30]]= function(_0x59f1xe,_0x59f1xc){return Promise[_0xc423[37]]([])[_0xc423[16]](getOpenchannelQueues(_0x59f1xe[_0xc423[23]]))[_0xc423[16]](function(_0x59f1x15){return OpenchannelRoom[_0xc423[36]](_[_0xc423[35]](Util[_0xc423[18]](_0x59f1xe[_0xc423[17]],{status:_0xc423[32],updatedAt:{$gte:moment()[_0xc423[34]](_0xc423[33])}}),_0x59f1x15))})[_0xc423[16]](function(_0x59f1x14){return _0x59f1xc[_0xc423[13]](200)[_0xc423[12]]({value:_0x59f1x14})})[_0xc423[15]](function(_0x59f1xd){console[_0xc423[31]](_0x59f1xd);return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[38]]= function(_0x59f1xe,_0x59f1xc){return Promise[_0xc423[37]]([])[_0xc423[16]](getOpenchannelQueues(_0x59f1xe[_0xc423[23]]))[_0xc423[16]](function(_0x59f1x15){return OpenchannelRoom[_0xc423[36]](_[_0xc423[35]](Util[_0xc423[18]](_0x59f1xe[_0xc423[17]],{status:_0xc423[39],updatedAt:{$gte:moment()[_0xc423[34]](_0xc423[33])}}),_0x59f1x15))})[_0xc423[16]](function(_0x59f1x14){return _0x59f1xc[_0xc423[13]](200)[_0xc423[12]]({value:_0x59f1x14})})[_0xc423[15]](function(_0x59f1xd){console[_0xc423[31]](_0x59f1xd);return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[40]]= function(_0x59f1xe,_0x59f1xc){return Promise[_0xc423[37]]([])[_0xc423[16]](getOpenchannelQueues(_0x59f1xe[_0xc423[23]]))[_0xc423[16]](function(_0x59f1x15){return OpenchannelRoom[_0xc423[36]](_[_0xc423[35]](Util[_0xc423[18]](_0x59f1xe[_0xc423[17]],{status:_0xc423[41],updatedAt:{$gte:moment()[_0xc423[34]](_0xc423[33])}}),_0x59f1x15))})[_0xc423[16]](function(_0x59f1x14){return _0x59f1xc[_0xc423[13]](200)[_0xc423[12]]({value:_0x59f1x14})})[_0xc423[15]](function(_0x59f1xd){console[_0xc423[31]](_0x59f1xd);return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[42]]= function(_0x59f1xe,_0x59f1xc){return Promise[_0xc423[37]]([])[_0xc423[16]](getOpenchannelQueues(_0x59f1xe[_0xc423[23]]))[_0xc423[16]](function(_0x59f1x15){return OpenchannelRoom[_0xc423[36]](_[_0xc423[35]](Util[_0xc423[18]](_0x59f1xe[_0xc423[17]],{status:_0xc423[43],updatedAt:{$gte:moment()[_0xc423[34]](_0xc423[33])}}),_0x59f1x15))})[_0xc423[16]](function(_0x59f1x14){return _0x59f1xc[_0xc423[13]](200)[_0xc423[12]]({value:_0x59f1x14})})[_0xc423[15]](function(_0x59f1xd){console[_0xc423[31]](_0x59f1xd);return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[44]]= function(_0x59f1xe,_0x59f1xc){return OpenchannelRoom[_0xc423[24]](_0xc423[20])[_0xc423[29]](_0x59f1xe[_0xc423[46]][_0xc423[22]])[_0xc423[16]](function(_0x59f1x16){if(!_0x59f1x16){return _0x59f1xc[_0xc423[45]](404)};return _0x59f1xc[_0xc423[12]](_0x59f1x16)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[47]]= function(_0x59f1xe,_0x59f1xc,_0x59f1x17){return OpenchannelRoom[_0xc423[29]](_0x59f1xe[_0xc423[46]][_0xc423[22]])[_0xc423[16]](function(_0x59f1x16){if(!_0x59f1x16){return _0x59f1xc[_0xc423[45]](404)};return _0x59f1x16[_0xc423[52]]({attributes:[_0xc423[22],_0xc423[48],_0xc423[49],_0xc423[50],_0xc423[25],_0xc423[51]]})})[_0xc423[16]](function(_0x59f1x18){return _0x59f1xc[_0xc423[12]](_0x59f1x18)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[53]]= function(_0x59f1xe,_0x59f1xc,_0x59f1x17){return OpenchannelMessage[_0xc423[29]](_0x59f1xe[_0xc423[46]][_0xc423[22]])[_0xc423[16]](function(_0x59f1x19){return _0x59f1x19[_0xc423[55]]({include:[{model:OpenchannelAccount},{model:OpenchannelMessage,include:[{model:User,attributes:[_0xc423[22],_0xc423[48],_0xc423[49],_0xc423[50]]}]},{model:User,attributes:[_0xc423[22],_0xc423[48],_0xc423[49],_0xc423[50]]}]})})[_0xc423[16]](function(_0x59f1x16){return _0x59f1xc[_0xc423[12]](_0x59f1x16)})[_0xc423[15]](function(_0x59f1xd){console[_0xc423[31]](_0xc423[54],_0x59f1xd);return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[56]]= function(_0x59f1xe,_0x59f1xc){return OpenchannelRoom[_0xc423[56]](_0x59f1xe[_0xc423[57]])[_0xc423[16]](function(_0x59f1x19){return _0x59f1xc[_0xc423[13]](201)[_0xc423[12]](_0x59f1x19)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[58]]= function(_0x59f1xe,_0x59f1xc,_0x59f1x17){_0x59f1xe[_0xc423[57]][_0xc423[59]]= _0x59f1xe[_0xc423[23]][_0xc423[22]];_0x59f1xe[_0xc423[57]][_0xc423[60]]= _0x59f1xe[_0xc423[46]][_0xc423[22]];return OpenchannelMessage[_0xc423[56]](_0x59f1xe[_0xc423[57]])[_0xc423[16]](function(_0x59f1x19){return _0x59f1xc[_0xc423[13]](201)[_0xc423[12]](_0x59f1x19)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[61]]= function(_0x59f1xe,_0x59f1xc){if(_0x59f1xe[_0xc423[57]][_0xc423[22]]){delete _0x59f1xe[_0xc423[57]][_0xc423[22]]};return OpenchannelRoom[_0xc423[29]](_0x59f1xe[_0xc423[46]][_0xc423[22]])[_0xc423[16]](function(_0x59f1x16){if(!_0x59f1x16){return _0x59f1xc[_0xc423[45]](404)};var _0x59f1x1a=_[_0xc423[35]](_0x59f1x16,_0x59f1xe[_0xc423[57]]);return _0x59f1x1a[_0xc423[62]]()})[_0xc423[16]](function(_0x59f1x16){return _0x59f1xc[_0xc423[13]](200)[_0xc423[12]](_0x59f1x16)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[63]]= function(_0x59f1xe,_0x59f1xc,_0x59f1x17){return OpenchannelRoom[_0xc423[29]](_0x59f1xe[_0xc423[46]][_0xc423[22]])[_0xc423[16]](function(_0x59f1x16){if(!_0x59f1x16){return _0x59f1xc[_0xc423[45]](404)};return _0x59f1x16[_0xc423[65]](_0x59f1xe[_0xc423[57]][_0xc423[64]],{individualHooks:true})})[_0xc423[16]](function(){return _0x59f1xc[_0xc423[45]](200)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[66]]= function(_0x59f1xe,_0x59f1xc){return OpenchannelRoom[_0xc423[29]](_0x59f1xe[_0xc423[46]][_0xc423[22]])[_0xc423[16]](function(_0x59f1x16){if(!_0x59f1x16){return _0x59f1xc[_0xc423[45]](404)};return _0x59f1x16[_0xc423[66]]()})[_0xc423[16]](function(){return _0x59f1xc[_0xc423[45]](204)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[67]]= function(_0x59f1xe,_0x59f1xc){return OpenchannelRoom[_0xc423[66]]({where:{id:_0x59f1xe[_0xc423[17]][_0xc423[68]]},individualHooks:true})[_0xc423[16]](function(){return _0x59f1xc[_0xc423[45]](200)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[69]]= function(_0x59f1xe,_0x59f1xc){return sequelize[_0xc423[17]](_0xc423[72],{type:sequelize[_0xc423[74]][_0xc423[73]]})[_0xc423[16]](function(_0x59f1x1b){var _0x59f1x1c=_[_0xc423[35]]({new:0,open:0,pending:0,closed:0},_[_0xc423[71]](_[_0xc423[70]](_0x59f1x1b,_0xc423[13]),_0xc423[36]));return _0x59f1xc[_0xc423[13]](200)[_0xc423[12]](_0x59f1x1c)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)})};exports[_0xc423[75]]= function(_0x59f1xe,_0x59f1xc,_0x59f1x17){var _0x59f1x1d={where:{id:_0x59f1xe[_0xc423[46]][_0xc423[22]][_0xc423[77]](_0xc423[76])},user:_0x59f1xe[_0xc423[23]],individualHooks:true};return OpenchannelRoom[_0xc423[61]](_0x59f1xe[_0xc423[57]],_0x59f1x1d)[_0xc423[16]](function(_0x59f1x1e){if(!_0x59f1x1e){return _0x59f1xc[_0xc423[45]](404)};return _0x59f1x1e})[_0xc423[16]](function(_0x59f1x1e){return _0x59f1xc[_0xc423[45]](200)})[_0xc423[15]](function(_0x59f1xd){return handleError(_0x59f1xc,_0x59f1xd)})}