09574904331d02c5ba6851b7ee43b9f490fc6728
[motion.git] / server / api / openchannel_account / openchannel_account.controller.js
1 var _0x2035=["\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","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x55\x73\x65\x72","\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","\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\x52\x6F\x6F\x6D","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x43\x6F\x6E\x74\x61\x63\x74","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6D\x6F\x6D\x65\x6E\x74","\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","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x67\x65\x74\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x73","\x6C\x65\x6E\x67\x74\x68","\x67\x65\x74\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x77\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x6E\x61\x6D\x65","\x6F\x6E\x6C\x69\x6E\x65","\x70\x72\x69\x6F\x72\x69\x74\x79\x20\x41\x53\x43","\x6D\x65\x72\x67\x65","\x67\x65\x74\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x64\x65\x66\x61\x75\x6C\x74","\x73\x63\x6F\x70\x65","\x63\x72\x65\x61\x74\x65","\x68\x61\x6E\x64\x6C\x65\x55\x6E\x69\x71\x75\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72\x4D\x61\x6E\x61\x67\x65\x72","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x73\x65\x6E\x64\x4D\x65\x73\x73\x61\x67\x65","\x55\x73\x65\x72\x49\x64","\x75\x73\x65\x72","\x72\x65\x63\x65\x69\x76\x65\x4D\x65\x73\x73\x61\x67\x65","\x6C\x6F\x67","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x52\x6F\x6F\x6D\x49\x64","\x52\x45\x43\x45\x49\x56\x45\x44","\x43\x4C\x4F\x53\x45\x44","\x66\x72\x6F\x6D","\x4E\x45\x57","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x4F\x50\x45\x4E","\x73\x79\x73\x74\x65\x6D","\x6F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x49\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x41\x63\x63\x6F\x75\x6E\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x52\x65\x63\x65\x69\x76\x65\x64\x20\x6D\x65\x73\x73\x61\x67\x65\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x63\x6F\x6E\x74\x61\x69\x6E\x20\x73\x65\x6E\x64\x65\x72\x20\x49\x64","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x44\x45\x53\x43","\x66\x69\x6E\x64\x41\x6C\x6C","\x75\x70\x64\x61\x74\x65","\x20\x20\x20\x65\x72\x72","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x64\x69\x73\x70\x49\x64","\x75\x70\x64\x61\x74\x65\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x70\x72\x69\x6F\x72\x69\x74\x79","\x66\x6F\x72\x45\x61\x63\x68","\x72\x65\x71\x20\x61\x70\x70","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x61\x70\x70\x49\x64","\x64\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x64\x65\x73\x74\x72\x6F\x79\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x69\x64\x73","\x67\x65\x74\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x52\x6F\x6F\x6D\x73","\x63\x6F\x6E\x74\x61\x63\x74","\x74\x61\x67\x73","\x64\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x6C\x61\x73\x74\x45\x76\x65\x6E\x74","\x69\x73\x41\x72\x72\x61\x79","\x25","\x70\x75\x73\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x69\x6E\x63\x6C\x75\x64\x65","\x65\x72\x72\x6F\x72","\x61\x67\x65\x6E\x74","\x66\x69\x6E\x64","\x6D\x61\x70","\x71\x75\x65\x75\x65","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x51\x75\x65\x75\x65\x49\x64","\x69\x6E\x74\x65\x72\x73\x65\x63\x74\x69\x6F\x6E","\x67\x65\x74\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x51\x75\x65\x75\x65\x73","\x72\x6F\x6C\x65","\x63\x72\x65\x61\x74\x65\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x65\x72\x72","\x6D\x61\x78"];_0x2035[0];var _=require(_0x2035[1]);var Util=require(_0x2035[2]);var OpenchannelAccount=require(_0x2035[4])[_0x2035[3]];var sequelize=require(_0x2035[4])[_0x2035[5]];var User=require(_0x2035[4])[_0x2035[6]];var OpenchannelQueue=require(_0x2035[4])[_0x2035[7]];var OpenchannelApplication=require(_0x2035[4])[_0x2035[8]];var OpenchannelMessage=require(_0x2035[4])[_0x2035[9]];var OpenchannelRoom=require(_0x2035[4])[_0x2035[10]];var OpenchannelDisposition=require(_0x2035[4])[_0x2035[11]];var OpenchannelAccount=require(_0x2035[4])[_0x2035[3]];var Contact=require(_0x2035[4])[_0x2035[12]];var Interval=require(_0x2035[4])[_0x2035[13]];var Promise=require(_0x2035[14]);var moment=require(_0x2035[15]);function handleError(_0x8569x10,_0x8569x11){return _0x8569x10[_0x2035[17]](500)[_0x2035[16]](_0x8569x11)}exports[_0x2035[18]]= function(_0x8569x12,_0x8569x10){return OpenchannelAccount[_0x2035[23]](Util[_0x2035[22]](_0x8569x12[_0x2035[21]]))[_0x2035[20]](function(_0x8569x13){_0x8569x10[_0x2035[17]](200)[_0x2035[16]](_0x8569x13)})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[24]]= function(_0x8569x12,_0x8569x10){return OpenchannelAccount[_0x2035[28]](_0x8569x12[_0x2035[27]][_0x2035[26]])[_0x2035[20]](function(_0x8569x14){if(!_0x8569x14){return _0x8569x10[_0x2035[25]](404)};return _0x8569x10[_0x2035[16]](_0x8569x14)})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[29]]= function(_0x8569x12,_0x8569x10,_0x8569x15){return OpenchannelAccount[_0x2035[28]](_0x8569x12[_0x2035[27]][_0x2035[26]])[_0x2035[20]](function(_0x8569x14){if(!_0x8569x14){return _0x8569x10[_0x2035[25]](404)};return _0x8569x14[_0x2035[31]]()})[_0x2035[20]](function(_0x8569x16){return _0x8569x10[_0x2035[17]](200)[_0x2035[16]]({rows:_0x8569x16,count:_0x8569x16[_0x2035[30]]})})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[32]]= function(_0x8569x12,_0x8569x10,_0x8569x15){return OpenchannelAccount[_0x2035[39]](_0x2035[38])[_0x2035[28]](_0x8569x12[_0x2035[27]][_0x2035[26]])[_0x2035[20]](function(_0x8569x14){if(!_0x8569x14){return _0x8569x10[_0x2035[25]](404)};return _0x8569x14[_0x2035[37]](_[_0x2035[36]](Util[_0x2035[22]](_0x8569x12[_0x2035[21]]),{include:[{model:OpenchannelQueue,attributes:[_0x2035[26],_0x2035[33]]},{model:User,attributes:[_0x2035[26],_0x2035[33],_0x2035[34]]},{model:Interval,attributes:[_0x2035[26],_0x2035[33]]}],order:_0x2035[35]}))})[_0x2035[20]](function(_0x8569x17){return _0x8569x10[_0x2035[16]]({count:_0x8569x17[_0x2035[30]],rows:_0x8569x17})})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[40]]= function(_0x8569x12,_0x8569x10){return OpenchannelAccount[_0x2035[40]](_0x8569x12[_0x2035[43]])[_0x2035[20]](function(_0x8569x14){return _0x8569x10[_0x2035[17]](201)[_0x2035[16]](_0x8569x14)})[_0x2035[19]](sequelize.UniqueConstraintError,function(_0x8569x11){return Util[_0x2035[42]][_0x2035[41]](_0x8569x10,_0x8569x11)})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[44]]= function(_0x8569x12,_0x8569x10,_0x8569x15){_0x8569x12[_0x2035[43]][_0x2035[45]]= _0x8569x12[_0x2035[27]][_0x2035[26]];return OpenchannelDisposition[_0x2035[40]](_0x8569x12[_0x2035[43]])[_0x2035[20]](function(_0x8569x18){return _0x8569x10[_0x2035[17]](201)[_0x2035[16]](_0x8569x18)})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[46]]= function(_0x8569x12,_0x8569x10,_0x8569x15){_0x8569x12[_0x2035[43]][_0x2035[45]]= _0x8569x12[_0x2035[27]][_0x2035[26]];_0x8569x12[_0x2035[43]][_0x2035[47]]= _0x8569x12[_0x2035[48]][_0x2035[26]];return OpenchannelMessage[_0x2035[40]](_0x8569x12[_0x2035[43]],{user:_0x8569x12[_0x2035[48]]})[_0x2035[20]](function(_0x8569x19){return _0x8569x10[_0x2035[17]](201)[_0x2035[16]](_0x8569x19)})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[49]]= function(_0x8569x12,_0x8569x10,_0x8569x15){if(_0x8569x12[_0x2035[43]][_0x2035[26]]){delete _0x8569x12[_0x2035[43]][_0x2035[26]]};var _0x8569x1a=_0x8569x12[_0x2035[43]];var _0x8569x1b;return OpenchannelAccount[_0x2035[28]](_0x8569x12[_0x2035[27]][_0x2035[26]])[_0x2035[20]](function(_0x8569x14){if(!_0x8569x14){throw  new Error(_0x2035[62])};_0x8569x1b= _0x8569x14;console[_0x2035[50]](_0x8569x1a);if(!_0x8569x1a[_0x2035[54]]){throw  new Error(_0x2035[63])};return OpenchannelRoom[_0x2035[66]]({limit:1,where:{contact:_0x8569x1a[_0x2035[54]],OpenchannelAccountId:_0x8569x1b[_0x2035[26]]},order:[[_0x2035[64],_0x2035[65]]]})})[_0x2035[20]](function(_0x8569x1e){var _0x8569x1d=_0x8569x1e[0];if(!_0x8569x1d|| _0x8569x1d[_0x2035[17]]== _0x2035[53]){var _0x8569x1f=_0x8569x1d?_0x8569x1d[_0x2035[26]]:null;return OpenchannelRoom[_0x2035[40]]({contact:_0x8569x1a[_0x2035[54]],OpenchannelAccountId:_0x8569x1b[_0x2035[26]],status:_0x2035[55],ParentId:_0x8569x1f,lastEvent:_0x2035[52],lastEventAt:moment()[_0x2035[57]](_0x2035[56]),openchannelIn:1})}else {return _0x8569x1d[_0x2035[61]]({lastEvent:_0x2035[52],lastEventAt:moment()[_0x2035[57]](_0x2035[56]),status:_0x2035[58],openReason:_0x2035[59],openchannelIn:++_0x8569x1d[_0x2035[60]]})}})[_0x2035[20]](function(_0x8569x1d){_0x8569x1a[_0x2035[45]]= _0x8569x1b[_0x2035[26]];_0x8569x1a[_0x2035[51]]= _0x8569x1d[_0x2035[26]];_0x8569x1a[_0x2035[17]]= _0x2035[52];return OpenchannelMessage[_0x2035[40]](_0x8569x1a)})[_0x2035[20]](function(_0x8569x1c){return _0x8569x10[_0x2035[17]](201)[_0x2035[16]](_0x8569x1c)})[_0x2035[19]](function(_0x8569x11){console[_0x2035[50]](_0x8569x11);return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[67]]= function(_0x8569x12,_0x8569x10){if(_0x8569x12[_0x2035[43]][_0x2035[26]]){delete _0x8569x12[_0x2035[43]][_0x2035[26]]};return OpenchannelAccount[_0x2035[28]](_0x8569x12[_0x2035[27]][_0x2035[26]])[_0x2035[20]](function(_0x8569x14){if(!_0x8569x14){return _0x8569x10[_0x2035[25]](404)};var _0x8569x20=_[_0x2035[36]](_0x8569x14,_0x8569x12[_0x2035[43]]);return _0x8569x20[_0x2035[69]]()})[_0x2035[20]](function(_0x8569x14){return _0x8569x10[_0x2035[17]](200)[_0x2035[16]](_0x8569x14)})[_0x2035[19]](sequelize.UniqueConstraintError,function(_0x8569x11){return Util[_0x2035[42]][_0x2035[41]](_0x8569x10,_0x8569x11)})[_0x2035[19]](function(_0x8569x11){console[_0x2035[50]](_0x2035[68],_0x8569x11);return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[70]]= function(_0x8569x12,_0x8569x10){if(_0x8569x12[_0x2035[43]][_0x2035[26]]){delete _0x8569x12[_0x2035[43]][_0x2035[26]]};return OpenchannelDisposition[_0x2035[28]](_0x8569x12[_0x2035[27]][_0x2035[71]])[_0x2035[20]](function(_0x8569x21){if(!_0x8569x21){return _0x8569x10[_0x2035[25]](404)};var _0x8569x20=_[_0x2035[36]](_0x8569x21,_0x8569x12[_0x2035[43]]);return _0x8569x20[_0x2035[69]]()})[_0x2035[20]](function(_0x8569x21){return _0x8569x10[_0x2035[17]](200)[_0x2035[16]](_0x8569x21)})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[72]]= function(_0x8569x12,_0x8569x10){var _0x8569x22=0;var _0x8569x23=_0x8569x12[_0x2035[43]];_0x8569x23[_0x2035[75]](function(_0x8569x24){delete _0x8569x24[_0x2035[26]];delete _0x8569x24[_0x2035[64]];delete _0x8569x24[_0x2035[73]];_0x8569x24[_0x2035[74]]=  ++_0x8569x22});console[_0x2035[50]](_0x2035[76],_0x8569x12[_0x2035[43]]);return sequelize[_0x2035[79]](function(_0x8569x26){return OpenchannelApplication[_0x2035[78]]({where:{OpenchannelAccountId:_0x8569x12[_0x2035[27]][_0x2035[26]]},individualHooks:true,transaction:_0x8569x26})[_0x2035[20]](function(_0x8569x27){return OpenchannelApplication[_0x2035[77]](_0x8569x23,{individualHooks:true,transaction:_0x8569x26})})})[_0x2035[20]](function(_0x8569x25){return _0x8569x10[_0x2035[17]](200)[_0x2035[16]]({count:_0x8569x25[_0x2035[30]],rows:_0x8569x25})})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[80]]= function(_0x8569x12,_0x8569x10){if(_0x8569x12[_0x2035[43]][_0x2035[26]]){delete _0x8569x12[_0x2035[43]][_0x2035[26]]};return OpenchannelApplication[_0x2035[28]](_0x8569x12[_0x2035[27]][_0x2035[81]])[_0x2035[20]](function(_0x8569x27){if(!_0x8569x27){return _0x8569x10[_0x2035[25]](404)};var _0x8569x20=_[_0x2035[36]](_0x8569x27,_0x8569x12[_0x2035[43]]);return _0x8569x20[_0x2035[69]]()})[_0x2035[20]](function(_0x8569x27){return _0x8569x10[_0x2035[17]](200)[_0x2035[16]](_0x8569x27)})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[78]]= function(_0x8569x12,_0x8569x10){return OpenchannelAccount[_0x2035[28]](_0x8569x12[_0x2035[27]][_0x2035[26]])[_0x2035[20]](function(_0x8569x14){if(!_0x8569x14){return _0x8569x10[_0x2035[25]](404)};return _0x8569x14[_0x2035[78]]()})[_0x2035[20]](function(){return _0x8569x10[_0x2035[25]](204)})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[82]]= function(_0x8569x12,_0x8569x10,_0x8569x15){return OpenchannelApplication[_0x2035[28]](_0x8569x12[_0x2035[27]][_0x2035[81]])[_0x2035[20]](function(_0x8569x27){if(!_0x8569x27){return _0x8569x10[_0x2035[25]](404)};return _0x8569x27[_0x2035[78]]()})[_0x2035[20]](function(){return _0x8569x10[_0x2035[25]](204)})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[83]]= function(_0x8569x12,_0x8569x10,_0x8569x15){return OpenchannelDisposition[_0x2035[28]](_0x8569x12[_0x2035[27]][_0x2035[71]])[_0x2035[20]](function(_0x8569x18){if(!_0x8569x18){return _0x8569x10[_0x2035[25]](404)};return _0x8569x18[_0x2035[78]]()})[_0x2035[20]](function(){return _0x8569x10[_0x2035[25]](204)})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[84]]= function(_0x8569x12,_0x8569x10){return OpenchannelApplication[_0x2035[78]]({where:{id:_0x8569x12[_0x2035[21]][_0x2035[85]]},individualHooks:true})[_0x2035[20]](function(){return _0x8569x10[_0x2035[25]](204)})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})};exports[_0x2035[86]]= function(_0x8569x12,_0x8569x10,_0x8569x15){var _0x8569x28={where:{OpenchannelAccountId:_0x8569x12[_0x2035[27]][_0x2035[26]],$and:[]},attributes:[_0x2035[26],_0x2035[87],_0x2035[73],_0x2035[88],_0x2035[89],_0x2035[90]],include:[]};if(_0x8569x12[_0x2035[21]]){if(_0x8569x12[_0x2035[21]][_0x2035[88]]){if(_[_0x2035[91]](_0x8569x12[_0x2035[21]][_0x2035[88]])){for(var _0x8569x29=0;_0x8569x29< _0x8569x12[_0x2035[21]][_0x2035[88]][_0x2035[30]];_0x8569x29++){_0x8569x28[_0x2035[95]][_0x2035[94]][_0x2035[93]]({tags:{$like:_0x2035[92]+ _0x8569x12[_0x2035[21]][_0x2035[88]][_0x8569x29]+ _0x2035[92]}})}}else {_0x8569x28[_0x2035[95]][_0x2035[94]][_0x2035[93]]({tags:{$like:_0x2035[92]+ _0x8569x12[_0x2035[21]][_0x2035[88]]+ _0x2035[92]}})};delete _0x8569x12[_0x2035[21]][_0x2035[88]]};_[_0x2035[36]](_0x8569x28[_0x2035[95]],_0x8569x12[_0x2035[21]])};switch(_0x8569x12[_0x2035[48]][_0x2035[105]]){case _0x2035[98]:_0x8569x28[_0x2035[96]][_0x2035[93]]({model:User,attributes:[_0x2035[26]]});var _0x8569x2a;var _0x8569x2b;var _0x8569x2c;return User[_0x2035[28]](_0x8569x12[_0x2035[48]][_0x2035[26]])[_0x2035[20]](function(_0x8569x2f){if(_0x8569x2f){return _0x8569x2f[_0x2035[104]]()}else {return []}})[_0x2035[20]](function(_0x8569x2e){_0x8569x2b= _[_0x2035[100]](_0x8569x2e,_0x2035[26]);return OpenchannelAccount[_0x2035[28]](_0x8569x12[_0x2035[27]][_0x2035[26]])})[_0x2035[20]](function(_0x8569x13){return _0x8569x13[_0x2035[37]]({where:{$or:[{app:_0x2035[101]},{app:_0x2035[98]}]}})})[_0x2035[20]](function(_0x8569x23){_0x8569x2a= _[_0x2035[100]](_[_0x2035[99]](_0x8569x23,{"\x61\x70\x70":_0x2035[98]}),_0x2035[47]);_0x8569x2c= _[_0x2035[100]](_[_0x2035[99]](_0x8569x23,{"\x61\x70\x70":_0x2035[101]}),_0x2035[102]);if(_[_0x2035[103]](_0x8569x2b,_0x8569x2c)[_0x2035[30]]|| _[_0x2035[103]](_0x8569x2a,[_0x8569x12[_0x2035[48]][_0x2035[26]]])[_0x2035[30]]){return OpenchannelRoom[_0x2035[66]](_0x8569x28)[_0x2035[20]](function(_0x8569x2d){return _0x8569x10[_0x2035[17]](200)[_0x2035[16]](_0x8569x2d)})[_0x2035[19]](function(_0x8569x11){console[_0x2035[97]](_0x8569x11);return handleError(_0x8569x10,_0x8569x11)})}else {return _0x8569x10[_0x2035[17]](200)[_0x2035[16]]([])}})[_0x2035[19]](function(_0x8569x11){console[_0x2035[97]](_0x8569x11)});default:return OpenchannelRoom[_0x2035[66]](_0x8569x28)[_0x2035[20]](function(_0x8569x2d){return _0x8569x10[_0x2035[17]](200)[_0x2035[16]](_0x8569x2d)})[_0x2035[19]](function(_0x8569x11){return handleError(_0x8569x10,_0x8569x11)})}};exports[_0x2035[106]]= function(_0x8569x12,_0x8569x10,_0x8569x15){return OpenchannelApplication[_0x2035[108]](_0x2035[74],{where:{OpenchannelAccountId:_0x8569x12[_0x2035[27]][_0x2035[26]]}})[_0x2035[20]](function(_0x8569x31){_0x8569x12[_0x2035[43]][_0x2035[74]]= _0x8569x31?++_0x8569x31:1;_0x8569x12[_0x2035[43]][_0x2035[45]]= _0x8569x12[_0x2035[27]][_0x2035[26]];return OpenchannelApplication[_0x2035[40]](_0x8569x12[_0x2035[43]])})[_0x2035[20]](function(_0x8569x30){return _0x8569x10[_0x2035[17]](201)[_0x2035[16]](_0x8569x30)})[_0x2035[19]](function(_0x8569x11){console[_0x2035[50]](_0x2035[107],_0x8569x11);return handleError(_0x8569x10,_0x8569x11)})}