Built motion from commit b6cf875.|1.0.15
[motion.git] / server / api / list / list.controller.js
1 var _0x5bf2=["\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","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4C\x69\x73\x74","\x54\x64\x55\x70\x64\x61\x74\x65","\x55\x73\x65\x72\x48\x61\x73\x4C\x69\x73\x74","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x43\x6F\x6E\x74\x61\x63\x74","\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","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x69\x64","\x6D\x61\x70","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x6D\x65\x72\x67\x65","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x63\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73","\x73\x63\x6F\x70\x65","\x67\x65\x74\x4C\x69\x73\x74\x73","\x75\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x67\x65\x6E\x74","\x72\x6F\x6C\x65","\x67\x65\x74\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73","\x6C\x6F\x67","\x70\x61\x72\x61\x6D\x73","\x67\x65\x74\x41\x6C\x6C\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73","\x67\x65\x74\x43\x6F\x6E\x74\x61\x63\x74","\x62\x6F\x64\x79","\x73\x70\x72\x65\x61\x64","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x67\x65\x74\x43\x6F\x6E\x74\x61\x63\x74\x73","\x70\x68\x6F\x6E\x65","\x6D\x6F\x62\x69\x6C\x65","\x66\x61\x78","\x65\x6D\x61\x69\x6C","\x77\x68\x65\x72\x65","\x25","\x66\x6F\x72\x49\x6E","\x6C\x65\x6E\x67\x74\x68","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x75\x70\x64\x61\x74\x65\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x73\x61\x76\x65","\x63\x72\x65\x61\x74\x65\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x4C\x69\x73\x74\x49\x64","\x41\x4C\x54\x45\x52\x20\x54\x41\x42\x4C\x45\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x41\x44\x44\x20\x43\x4F\x4C\x55\x4D\x4E\x20\x25\x73\x20\x56\x41\x52\x43\x48\x41\x52\x28\x32\x35\x35\x29","\x6E\x61\x6D\x65","\x66\x6F\x72\x6D\x61\x74","\x63\x66\x5F","\x63\x72\x65\x61\x74\x65","\x73\x68\x6F\x77","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x64\x4D\x65\x73\x73\x61\x67\x65","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x4C\x49\x53\x54","\x6D\x65\x73\x73\x61\x67\x65","\x54\x68\x65\x20\x6C\x69\x73\x74\x20\x6E\x61\x6D\x65\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73","\x6C\x69\x73\x74\x2F\x69\x6E\x73\x65\x72\x74","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x6C\x69\x73\x74\x2F\x75\x70\x64\x61\x74\x65","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x67\x65\x74\x55\x73\x65\x72\x73","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x61\x67\x65\x6E\x74\x73","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x61\x6C\x6C","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x41\x4C\x54\x45\x52\x20\x54\x41\x42\x4C\x45\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x44\x52\x4F\x50\x20\x43\x4F\x4C\x55\x4D\x4E\x20\x25\x73","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x6B\x65\x79\x73","\x64\x65\x73\x63\x72\x69\x62\x65","\x72\x65\x6D\x6F\x76\x65\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x72\x65\x6D\x6F\x76\x65\x41\x6C\x6C\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73"];_0x5bf2[0];var _=require(_0x5bf2[1]);var util=require(_0x5bf2[2]);var BPromise=require(_0x5bf2[3]);var User=require(_0x5bf2[5])[_0x5bf2[4]];var List=require(_0x5bf2[5])[_0x5bf2[6]];var TdUpdate=require(_0x5bf2[5])[_0x5bf2[7]];var UserHasList=require(_0x5bf2[5])[_0x5bf2[8]];var CustomField=require(_0x5bf2[5])[_0x5bf2[9]];var Contact=require(_0x5bf2[5])[_0x5bf2[10]];var Util=require(_0x5bf2[11]);var sequelize=require(_0x5bf2[5])[_0x5bf2[12]];exports[_0x5bf2[13]]= function(_0xb834xc,_0xb834xd,_0xb834xe){switch(_0xb834xc[_0x5bf2[27]][_0x5bf2[30]]){case _0x5bf2[29]:return User[_0x5bf2[28]](_0xb834xc[_0x5bf2[27]][_0x5bf2[18]])[_0x5bf2[17]](function(_0xb834x13){return _0xb834x13[_0x5bf2[26]]()})[_0x5bf2[17]](function(_0xb834x11){var _0xb834x12=_[_0x5bf2[19]](_0xb834x11,_0x5bf2[18]);return List[_0x5bf2[25]](_0x5bf2[24])[_0x5bf2[23]](_[_0x5bf2[22]](Util[_0x5bf2[21]](_0xb834xc[_0x5bf2[20]],{$or:[{defaultEntry:true},{id:_0xb834x12}]}),{distinct:true}))})[_0x5bf2[17]](function(_0xb834x10){_0xb834xd[_0x5bf2[16]](200)[_0x5bf2[15]](_0xb834x10)})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)});default:return List[_0x5bf2[25]](_0x5bf2[24])[_0x5bf2[23]](_[_0x5bf2[22]](Util[_0x5bf2[21]](_0xb834xc[_0x5bf2[20]]),{distinct:true}))[_0x5bf2[17]](function(_0xb834x10){_0xb834xd[_0x5bf2[16]](200)[_0x5bf2[15]](_0xb834x10)})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)})}};exports[_0x5bf2[31]]= function(_0xb834xc,_0xb834xd){return CustomField[_0x5bf2[23]]({where:{ListId:_0xb834xc[_0x5bf2[33]][_0x5bf2[18]]}})[_0x5bf2[17]](function(_0xb834x14){return _0xb834xd[_0x5bf2[16]](200)[_0x5bf2[15]](_0xb834x14)})[_0x5bf2[14]](function(_0xb834xf){console[_0x5bf2[32]](_0xb834xf);return handleError(_0xb834xd,_0xb834xf)})};exports[_0x5bf2[34]]= function(_0xb834xc,_0xb834xd){return CustomField[_0x5bf2[23]]({where:{$or:[{ListId:_0xb834xc[_0x5bf2[33]][_0x5bf2[18]]},{ListId:null}]}})[_0x5bf2[17]](function(_0xb834x14){return _0xb834xd[_0x5bf2[16]](200)[_0x5bf2[15]](_0xb834x14)})[_0x5bf2[14]](function(_0xb834xf){console[_0x5bf2[32]](_0xb834xf);return handleError(_0xb834xd,_0xb834xf)})};exports[_0x5bf2[35]]= function(_0xb834xc,_0xb834xd){var _0xb834x15=_[_0x5bf2[22]](_0xb834xc[_0x5bf2[36]],{ListId:_0xb834xc[_0x5bf2[33]][_0x5bf2[18]]});return Contact[_0x5bf2[38]]({where:_0xb834x15,default:_0xb834xc[_0x5bf2[36]]})[_0x5bf2[37]](function(_0xb834x16){return _0xb834xd[_0x5bf2[16]](200)[_0x5bf2[15]](_0xb834x16)})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)})};exports[_0x5bf2[39]]= function(_0xb834xc,_0xb834xd){var _0xb834x17={where:{ListId:_0xb834xc[_0x5bf2[33]][_0x5bf2[18]]},attributes:[_0x5bf2[40],_0x5bf2[41],_0x5bf2[42],_0x5bf2[43]]};_[_0x5bf2[46]](_0xb834xc[_0x5bf2[20]],function(_0xb834x18,_0xb834x19){_0xb834x17[_0x5bf2[44]][_0xb834x19]= {$like:_0x5bf2[45]+ _0xb834x18+ _0x5bf2[45]}});return Contact[_0x5bf2[48]](_0xb834x17)[_0x5bf2[17]](function(_0xb834x1a){return _0xb834xd[_0x5bf2[16]](200)[_0x5bf2[15]]({rows:_0xb834x1a,length:_0xb834x1a[_0x5bf2[47]]})})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)})};exports[_0x5bf2[49]]= function(_0xb834xc,_0xb834xd){return CustomField[_0x5bf2[28]](_0xb834xc[_0x5bf2[33]][_0x5bf2[18]])[_0x5bf2[17]](function(_0xb834x1b){if(!_0xb834x1b){return _0xb834xd[_0x5bf2[50]](404)};return _0xb834xd[_0x5bf2[16]](200)[_0x5bf2[15]](_0xb834x1b)})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)})};exports[_0x5bf2[51]]= function(_0xb834xc,_0xb834xd){return CustomField[_0x5bf2[28]](_0xb834xc[_0x5bf2[33]][_0x5bf2[18]])[_0x5bf2[17]](function(_0xb834x1b){if(!_0xb834x1b){return _0xb834xd[_0x5bf2[50]](404)};var _0xb834x1c=_[_0x5bf2[22]](_0xb834x1b,_0xb834xc[_0x5bf2[36]]);return _0xb834x1c[_0x5bf2[52]]()})[_0x5bf2[17]](function(_0xb834x1b){return _0xb834xd[_0x5bf2[16]](200)[_0x5bf2[15]](_0xb834x1b)})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)})};exports[_0x5bf2[53]]= function(_0xb834xc,_0xb834xd){var _0xb834x1d;_0xb834xc[_0x5bf2[36]][_0x5bf2[54]]= _0xb834xc[_0x5bf2[33]][_0x5bf2[18]];return CustomField[_0x5bf2[59]](_0xb834xc[_0x5bf2[36]])[_0x5bf2[17]](function(_0xb834x1b){_0xb834x1d= _0xb834x1b;_0xb834x1b[_0x5bf2[56]]= _0x5bf2[58]+ _0xb834x1b[_0x5bf2[18]];return _0xb834x1b[_0x5bf2[52]]()})[_0x5bf2[17]](function(){return sequelize[_0x5bf2[20]](util[_0x5bf2[57]](_0x5bf2[55],_0xb834x1d[_0x5bf2[56]]))})[_0x5bf2[17]](function(){return _0xb834xd[_0x5bf2[50]](201)})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)})};exports[_0x5bf2[60]]= function(_0xb834xc,_0xb834xd){return List[_0x5bf2[28]](_0xb834xc[_0x5bf2[33]][_0x5bf2[18]])[_0x5bf2[17]](function(_0xb834x1e){if(!_0xb834x1e){return _0xb834xd[_0x5bf2[50]](404)};return _0xb834xd[_0x5bf2[15]](_0xb834x1e)})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)})};exports[_0x5bf2[59]]= function(_0xb834xc,_0xb834xd){var _0xb834x1f;return sequelize[_0x5bf2[66]](function(_0xb834x20){return List[_0x5bf2[59]](_0xb834xc[_0x5bf2[36]])[_0x5bf2[17]](function(_0xb834x1e){_0xb834x1f= _0xb834x1e;return TdUpdate[_0x5bf2[59]]({action:_0x5bf2[65],listId:_0xb834x1f[_0x5bf2[18]]})})[_0x5bf2[17]](function(){return _0xb834xd[_0x5bf2[16]](201)[_0x5bf2[15]](_0xb834x1f)})})[_0x5bf2[14]](sequelize.UniqueConstraintError,function(_0xb834xf){_0xb834xf[_0x5bf2[61]]= _0x5bf2[62];_0xb834xf[_0x5bf2[63]]= _0x5bf2[64];return _0xb834xd[_0x5bf2[16]](500)[_0x5bf2[15]](_0xb834xf)})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)})};exports[_0x5bf2[67]]= function(_0xb834xc,_0xb834xd){var _0xb834x1f;return List[_0x5bf2[28]](_0xb834xc[_0x5bf2[33]][_0x5bf2[18]])[_0x5bf2[17]](function(_0xb834x1e){if(!_0xb834x1e){return _0xb834xd[_0x5bf2[50]](404)};if(_0xb834xc[_0x5bf2[36]][_0x5bf2[18]]){delete _0xb834xc[_0x5bf2[36]][_0x5bf2[18]]};var _0xb834x1c=_[_0x5bf2[22]](_0xb834x1e,_0xb834xc[_0x5bf2[36]]);return _0xb834x1c[_0x5bf2[52]]()})[_0x5bf2[17]](function(_0xb834x1e){_0xb834x1f= _0xb834x1e;return TdUpdate[_0x5bf2[59]]({action:_0x5bf2[68],listId:_0xb834x1f[_0x5bf2[18]]})})[_0x5bf2[17]](function(){return _0xb834xd[_0x5bf2[16]](200)[_0x5bf2[15]](_0xb834x1f)})[_0x5bf2[14]](sequelize.UniqueConstraintError,function(_0xb834xf){_0xb834xf[_0x5bf2[61]]= _0x5bf2[62];_0xb834xf[_0x5bf2[63]]= _0x5bf2[64];return _0xb834xd[_0x5bf2[16]](500)[_0x5bf2[15]](_0xb834xf)})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)})};exports[_0x5bf2[69]]= function(_0xb834xc,_0xb834xd){return List[_0x5bf2[28]](_0xb834xc[_0x5bf2[33]][_0x5bf2[18]])[_0x5bf2[17]](function(_0xb834x1e){if(!_0xb834x1e){return _0xb834xd[_0x5bf2[50]](404)};return _0xb834x1e[_0x5bf2[71]]({where:{role:_0x5bf2[29]},attributes:[_0x5bf2[18],_0x5bf2[56],_0x5bf2[70],_0x5bf2[43]]})})[_0x5bf2[17]](function(_0xb834x21){return _0xb834xd[_0x5bf2[16]](200)[_0x5bf2[15]]({rows:_0xb834x21,count:_0xb834x21[_0x5bf2[47]]})})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)})};exports[_0x5bf2[72]]= function(_0xb834xc,_0xb834xd,_0xb834xe){return User[_0x5bf2[48]]({where:{id:_0xb834xc[_0x5bf2[36]][_0x5bf2[74]]}})[_0x5bf2[17]](function(_0xb834x22){var _0xb834x23=_[_0x5bf2[19]](_0xb834x22,function(_0xb834x24){return {list:_0xb834xc[_0x5bf2[33]][_0x5bf2[18]],membername:_0xb834x24[_0x5bf2[56]],UserId:_0xb834x24[_0x5bf2[18]]}});return UserHasList[_0x5bf2[73]](_0xb834x23,{individualHooks:true})})[_0x5bf2[17]](function(){return _0xb834xd[_0x5bf2[50]](200)})[_0x5bf2[14]](function(_0xb834xf){console[_0x5bf2[32]](_0xb834xf);return _0xb834xe(_0xb834xf)})};exports[_0x5bf2[75]]= function(_0xb834xc,_0xb834xd,_0xb834xe){return UserHasList[_0x5bf2[76]]({where:{UserId:_0xb834xc[_0x5bf2[20]][_0x5bf2[74]],list:_0xb834xc[_0x5bf2[33]][_0x5bf2[18]]},individualHooks:true})[_0x5bf2[17]](function(){return _0xb834xd[_0x5bf2[50]](202)})[_0x5bf2[14]](function(_0xb834xf){return _0xb834xe(_0xb834xf)})};exports[_0x5bf2[76]]= function(_0xb834xc,_0xb834xd){return destroyList(_0xb834xc[_0x5bf2[33]][_0x5bf2[18]],_0xb834xd)};exports[_0x5bf2[77]]= function(_0xb834xc,_0xb834xd){return destroyList(_0xb834xc[_0x5bf2[20]][_0x5bf2[78]],_0xb834xd)};function destroyList(_0xb834x26,_0xb834xd){return delCf(_0xb834x26,_0xb834xd)[_0x5bf2[79]]()[_0x5bf2[17]](function(){return List[_0x5bf2[76]]({where:{id:_0xb834x26},individualHooks:true})})[_0x5bf2[17]](function(){return _0xb834xd[_0x5bf2[50]](204)})[_0x5bf2[14]](function(_0xb834xf){console[_0x5bf2[32]](_0xb834xf);return handleError(_0xb834xd,_0xb834xf)})}function delCf(_0xb834x26,_0xb834xd){var _0xb834x28;return CustomField[_0x5bf2[48]]({where:{ListId:_0xb834x26}})[_0x5bf2[17]](function(_0xb834x2d){if(!_0xb834x2d){return _0xb834xd[_0x5bf2[50]](404)};_0xb834x28= _0xb834x2d;return CustomField[_0x5bf2[76]]({where:{id:_0xb834x26}})})[_0x5bf2[17]](function(){return Contact[_0x5bf2[85]]()})[_0x5bf2[17]](function(_0xb834x2c){return _[_0x5bf2[84]](_0xb834x2c)})[_0x5bf2[17]](function(_0xb834x29){var _0xb834x2a=[];_[_0x5bf2[83]](_0xb834x28,function(_0xb834x2b){if(_[_0x5bf2[80]](_0xb834x29,_0xb834x2b[_0x5bf2[56]])){_0xb834x2a[_0x5bf2[82]](sequelize[_0x5bf2[20]](util[_0x5bf2[57]](_0x5bf2[81],_0xb834x2b[_0x5bf2[56]])))}});return _0xb834x2a})}exports[_0x5bf2[86]]= function(_0xb834xc,_0xb834xd){var _0xb834x2e;return CustomField[_0x5bf2[28]](_0xb834xc[_0x5bf2[33]][_0x5bf2[18]])[_0x5bf2[17]](function(_0xb834x2f){if(!_0xb834x2f){return _0xb834xd[_0x5bf2[50]](404)};_0xb834x2e= _0xb834x2f;return CustomField[_0x5bf2[76]]({where:{id:_0xb834xc[_0x5bf2[33]][_0x5bf2[18]]}})})[_0x5bf2[17]](function(){return Contact[_0x5bf2[85]]()})[_0x5bf2[17]](function(_0xb834x2c){return _[_0x5bf2[84]](_0xb834x2c)})[_0x5bf2[17]](function(_0xb834x29){if(_[_0x5bf2[80]](_0xb834x29,_0xb834x2e[_0x5bf2[56]])){return sequelize[_0x5bf2[20]](util[_0x5bf2[57]](_0x5bf2[81],_0xb834x2e[_0x5bf2[56]]))}})[_0x5bf2[17]](function(){return _0xb834xd[_0x5bf2[50]](204)})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)})};exports[_0x5bf2[87]]= function(_0xb834xc,_0xb834xd){var _0xb834x28;return CustomField[_0x5bf2[48]]({where:{id:_0xb834xc[_0x5bf2[20]][_0x5bf2[78]]}})[_0x5bf2[17]](function(_0xb834x2d){if(!_0xb834x2d){return _0xb834xd[_0x5bf2[50]](404)};_0xb834x28= _0xb834x2d;return CustomField[_0x5bf2[76]]({where:{id:_0xb834xc[_0x5bf2[20]][_0x5bf2[78]]}})})[_0x5bf2[17]](function(){return Contact[_0x5bf2[85]]()})[_0x5bf2[17]](function(_0xb834x2c){return _[_0x5bf2[84]](_0xb834x2c)})[_0x5bf2[17]](function(_0xb834x29){var _0xb834x2a=[];_0xb834x28[_0x5bf2[83]](function(_0xb834x2b){if(_[_0x5bf2[80]](_0xb834x29,_0xb834x2b[_0x5bf2[56]])){_0xb834x2a[_0x5bf2[82]](sequelize[_0x5bf2[20]](util[_0x5bf2[57]](_0x5bf2[81],_0xb834x2b[_0x5bf2[56]])))}});return _0xb834x2a})[_0x5bf2[79]]()[_0x5bf2[17]](function(){return _0xb834xd[_0x5bf2[50]](204)})[_0x5bf2[14]](function(_0xb834xf){return handleError(_0xb834xd,_0xb834xf)})};function handleError(_0xb834xd,_0xb834xf){return _0xb834xd[_0x5bf2[16]](500)[_0x5bf2[15]](_0xb834xf)}