Built motion from commit 9362eee.|1.0.9
[motion.git] / server / api / list / list.controller.js
1 var _0x66af=["\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\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","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\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","\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"];_0x66af[0];var _=require(_0x66af[1]);var util=require(_0x66af[2]);var BPromise=require(_0x66af[3]);var User=require(_0x66af[5])[_0x66af[4]];var List=require(_0x66af[5])[_0x66af[6]];var TdUpdate=require(_0x66af[5])[_0x66af[7]];var UserHasList=require(_0x66af[5])[_0x66af[8]];var CustomField=require(_0x66af[5])[_0x66af[9]];var Contact=require(_0x66af[5])[_0x66af[10]];var Util=require(_0x66af[11]);var sequelize=require(_0x66af[5])[_0x66af[12]];exports[_0x66af[13]]= function(_0x88cdxc,_0x88cdxd,_0x88cdxe){switch(_0x88cdxc[_0x66af[27]][_0x66af[30]]){case _0x66af[29]:return User[_0x66af[28]](_0x88cdxc[_0x66af[27]][_0x66af[18]])[_0x66af[17]](function(_0x88cdx13){return _0x88cdx13[_0x66af[26]]()})[_0x66af[17]](function(_0x88cdx11){var _0x88cdx12=_[_0x66af[19]](_0x88cdx11,_0x66af[18]);return List[_0x66af[25]](_0x66af[24])[_0x66af[23]](_[_0x66af[22]](Util[_0x66af[21]](_0x88cdxc[_0x66af[20]],{$or:[{defaultEntry:true},{id:_0x88cdx12}]}),{distinct:true}))})[_0x66af[17]](function(_0x88cdx10){_0x88cdxd[_0x66af[16]](200)[_0x66af[15]](_0x88cdx10)})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)});default:return List[_0x66af[25]](_0x66af[24])[_0x66af[23]](_[_0x66af[22]](Util[_0x66af[21]](_0x88cdxc[_0x66af[20]]),{distinct:true}))[_0x66af[17]](function(_0x88cdx10){_0x88cdxd[_0x66af[16]](200)[_0x66af[15]](_0x88cdx10)})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)})}};exports[_0x66af[31]]= function(_0x88cdxc,_0x88cdxd){return CustomField[_0x66af[23]]({where:{ListId:_0x88cdxc[_0x66af[33]][_0x66af[18]]}})[_0x66af[17]](function(_0x88cdx14){return _0x88cdxd[_0x66af[16]](200)[_0x66af[15]](_0x88cdx14)})[_0x66af[14]](function(_0x88cdxf){console[_0x66af[32]](_0x88cdxf);return handleError(_0x88cdxd,_0x88cdxf)})};exports[_0x66af[34]]= function(_0x88cdxc,_0x88cdxd){var _0x88cdx15=_[_0x66af[22]](_0x88cdxc[_0x66af[35]],{ListId:_0x88cdxc[_0x66af[33]][_0x66af[18]]});return Contact[_0x66af[37]]({where:_0x88cdx15,default:_0x88cdxc[_0x66af[35]]})[_0x66af[36]](function(_0x88cdx16){return _0x88cdxd[_0x66af[16]](200)[_0x66af[15]](_0x88cdx16)})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)})};exports[_0x66af[38]]= function(_0x88cdxc,_0x88cdxd){var _0x88cdx17={where:{ListId:_0x88cdxc[_0x66af[33]][_0x66af[18]]},attributes:[_0x66af[39],_0x66af[40],_0x66af[41],_0x66af[42]]};_[_0x66af[45]](_0x88cdxc[_0x66af[20]],function(_0x88cdx18,_0x88cdx19){_0x88cdx17[_0x66af[43]][_0x88cdx19]= {$like:_0x66af[44]+ _0x88cdx18+ _0x66af[44]}});return Contact[_0x66af[47]](_0x88cdx17)[_0x66af[17]](function(_0x88cdx1a){return _0x88cdxd[_0x66af[16]](200)[_0x66af[15]]({rows:_0x88cdx1a,length:_0x88cdx1a[_0x66af[46]]})})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)})};exports[_0x66af[48]]= function(_0x88cdxc,_0x88cdxd){return CustomField[_0x66af[28]](_0x88cdxc[_0x66af[33]][_0x66af[18]])[_0x66af[17]](function(_0x88cdx1b){if(!_0x88cdx1b){return _0x88cdxd[_0x66af[49]](404)};return _0x88cdxd[_0x66af[16]](200)[_0x66af[15]](_0x88cdx1b)})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)})};exports[_0x66af[50]]= function(_0x88cdxc,_0x88cdxd){return CustomField[_0x66af[28]](_0x88cdxc[_0x66af[33]][_0x66af[18]])[_0x66af[17]](function(_0x88cdx1b){if(!_0x88cdx1b){return _0x88cdxd[_0x66af[49]](404)};var _0x88cdx1c=_[_0x66af[22]](_0x88cdx1b,_0x88cdxc[_0x66af[35]]);return _0x88cdx1c[_0x66af[51]]()})[_0x66af[17]](function(_0x88cdx1b){return _0x88cdxd[_0x66af[16]](200)[_0x66af[15]](_0x88cdx1b)})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)})};exports[_0x66af[52]]= function(_0x88cdxc,_0x88cdxd){var _0x88cdx1d;_0x88cdxc[_0x66af[35]][_0x66af[53]]= _0x88cdxc[_0x66af[33]][_0x66af[18]];return sequelize[_0x66af[59]](function(_0x88cdx1e){return CustomField[_0x66af[58]](_0x88cdxc[_0x66af[35]])[_0x66af[17]](function(_0x88cdx1b){_0x88cdx1d= _0x88cdx1b;_0x88cdx1b[_0x66af[55]]= _0x66af[57]+ _0x88cdx1b[_0x66af[18]];return _0x88cdx1b[_0x66af[51]]()})[_0x66af[17]](function(){return sequelize[_0x66af[20]](util[_0x66af[56]](_0x66af[54],_0x88cdx1d[_0x66af[55]]))})[_0x66af[17]](function(){return _0x88cdxd[_0x66af[49]](201)})})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)})};exports[_0x66af[60]]= function(_0x88cdxc,_0x88cdxd){return List[_0x66af[28]](_0x88cdxc[_0x66af[33]][_0x66af[18]])[_0x66af[17]](function(_0x88cdx1f){if(!_0x88cdx1f){return _0x88cdxd[_0x66af[49]](404)};return _0x88cdxd[_0x66af[15]](_0x88cdx1f)})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)})};exports[_0x66af[58]]= function(_0x88cdxc,_0x88cdxd){var _0x88cdx20;return sequelize[_0x66af[59]](function(_0x88cdx1e){return List[_0x66af[58]](_0x88cdxc[_0x66af[35]])[_0x66af[17]](function(_0x88cdx1f){_0x88cdx20= _0x88cdx1f;return TdUpdate[_0x66af[58]]({action:_0x66af[65],listId:_0x88cdx20[_0x66af[18]]})})[_0x66af[17]](function(){return _0x88cdxd[_0x66af[16]](201)[_0x66af[15]](_0x88cdx20)})})[_0x66af[14]](sequelize.UniqueConstraintError,function(_0x88cdxf){_0x88cdxf[_0x66af[61]]= _0x66af[62];_0x88cdxf[_0x66af[63]]= _0x66af[64];return _0x88cdxd[_0x66af[16]](500)[_0x66af[15]](_0x88cdxf)})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)})};exports[_0x66af[66]]= function(_0x88cdxc,_0x88cdxd){var _0x88cdx20;return List[_0x66af[28]](_0x88cdxc[_0x66af[33]][_0x66af[18]])[_0x66af[17]](function(_0x88cdx1f){if(!_0x88cdx1f){return _0x88cdxd[_0x66af[49]](404)};if(_0x88cdxc[_0x66af[35]][_0x66af[18]]){delete _0x88cdxc[_0x66af[35]][_0x66af[18]]};var _0x88cdx1c=_[_0x66af[22]](_0x88cdx1f,_0x88cdxc[_0x66af[35]]);return _0x88cdx1c[_0x66af[51]]()})[_0x66af[17]](function(_0x88cdx1f){_0x88cdx20= _0x88cdx1f;return TdUpdate[_0x66af[58]]({action:_0x66af[67],listId:_0x88cdx20[_0x66af[18]]})})[_0x66af[17]](function(){return _0x88cdxd[_0x66af[16]](200)[_0x66af[15]](_0x88cdx20)})[_0x66af[14]](sequelize.UniqueConstraintError,function(_0x88cdxf){_0x88cdxf[_0x66af[61]]= _0x66af[62];_0x88cdxf[_0x66af[63]]= _0x66af[64];return _0x88cdxd[_0x66af[16]](500)[_0x66af[15]](_0x88cdxf)})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)})};exports[_0x66af[68]]= function(_0x88cdxc,_0x88cdxd){return List[_0x66af[28]](_0x88cdxc[_0x66af[33]][_0x66af[18]])[_0x66af[17]](function(_0x88cdx1f){if(!_0x88cdx1f){return _0x88cdxd[_0x66af[49]](404)};return _0x88cdx1f[_0x66af[70]]({where:{role:_0x66af[29]},attributes:[_0x66af[18],_0x66af[55],_0x66af[69],_0x66af[42]]})})[_0x66af[17]](function(_0x88cdx21){return _0x88cdxd[_0x66af[16]](200)[_0x66af[15]]({rows:_0x88cdx21,count:_0x88cdx21[_0x66af[46]]})})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)})};exports[_0x66af[71]]= function(_0x88cdxc,_0x88cdxd,_0x88cdxe){return User[_0x66af[47]]({where:{id:_0x88cdxc[_0x66af[35]][_0x66af[73]]}})[_0x66af[17]](function(_0x88cdx22){var _0x88cdx23=_[_0x66af[19]](_0x88cdx22,function(_0x88cdx24){return {list:_0x88cdxc[_0x66af[33]][_0x66af[18]],membername:_0x88cdx24[_0x66af[55]],UserId:_0x88cdx24[_0x66af[18]]}});return UserHasList[_0x66af[72]](_0x88cdx23,{individualHooks:true})})[_0x66af[17]](function(){return _0x88cdxd[_0x66af[49]](200)})[_0x66af[14]](function(_0x88cdxf){console[_0x66af[32]](_0x88cdxf);return _0x88cdxe(_0x88cdxf)})};exports[_0x66af[74]]= function(_0x88cdxc,_0x88cdxd,_0x88cdxe){return UserHasList[_0x66af[75]]({where:{UserId:_0x88cdxc[_0x66af[20]][_0x66af[73]],list:_0x88cdxc[_0x66af[33]][_0x66af[18]]},individualHooks:true})[_0x66af[17]](function(){return _0x88cdxd[_0x66af[49]](202)})[_0x66af[14]](function(_0x88cdxf){return _0x88cdxe(_0x88cdxf)})};exports[_0x66af[75]]= function(_0x88cdxc,_0x88cdxd){return destroyList(_0x88cdxc[_0x66af[33]][_0x66af[18]],_0x88cdxd)};exports[_0x66af[76]]= function(_0x88cdxc,_0x88cdxd){return destroyList(_0x88cdxc[_0x66af[20]][_0x66af[77]],_0x88cdxd)};function destroyList(_0x88cdx26,_0x88cdxd){return delCf(_0x88cdx26,_0x88cdxd)[_0x66af[78]]()[_0x66af[17]](function(){return List[_0x66af[75]]({where:{id:_0x88cdx26},individualHooks:true})})[_0x66af[17]](function(){return _0x88cdxd[_0x66af[49]](204)})[_0x66af[14]](function(_0x88cdxf){console[_0x66af[32]](_0x88cdxf);return handleError(_0x88cdxd,_0x88cdxf)})}function delCf(_0x88cdx26,_0x88cdxd){var _0x88cdx28;return CustomField[_0x66af[47]]({where:{ListId:_0x88cdx26}})[_0x66af[17]](function(_0x88cdx2d){if(!_0x88cdx2d){return _0x88cdxd[_0x66af[49]](404)};_0x88cdx28= _0x88cdx2d;return CustomField[_0x66af[75]]({where:{id:_0x88cdx26}})})[_0x66af[17]](function(){return Contact[_0x66af[84]]()})[_0x66af[17]](function(_0x88cdx2c){return _[_0x66af[83]](_0x88cdx2c)})[_0x66af[17]](function(_0x88cdx29){var _0x88cdx2a=[];_[_0x66af[82]](_0x88cdx28,function(_0x88cdx2b){if(_[_0x66af[79]](_0x88cdx29,_0x88cdx2b[_0x66af[55]])){_0x88cdx2a[_0x66af[81]](sequelize[_0x66af[20]](util[_0x66af[56]](_0x66af[80],_0x88cdx2b[_0x66af[55]])))}});return _0x88cdx2a})}exports[_0x66af[85]]= function(_0x88cdxc,_0x88cdxd){var _0x88cdx2e;return CustomField[_0x66af[28]](_0x88cdxc[_0x66af[33]][_0x66af[18]])[_0x66af[17]](function(_0x88cdx2f){if(!_0x88cdx2f){return _0x88cdxd[_0x66af[49]](404)};_0x88cdx2e= _0x88cdx2f;return CustomField[_0x66af[75]]({where:{id:_0x88cdxc[_0x66af[33]][_0x66af[18]]}})})[_0x66af[17]](function(){return Contact[_0x66af[84]]()})[_0x66af[17]](function(_0x88cdx2c){return _[_0x66af[83]](_0x88cdx2c)})[_0x66af[17]](function(_0x88cdx29){if(_[_0x66af[79]](_0x88cdx29,_0x88cdx2e[_0x66af[55]])){return sequelize[_0x66af[20]](util[_0x66af[56]](_0x66af[80],_0x88cdx2e[_0x66af[55]]))}})[_0x66af[17]](function(){return _0x88cdxd[_0x66af[49]](204)})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)})};exports[_0x66af[86]]= function(_0x88cdxc,_0x88cdxd){var _0x88cdx28;return CustomField[_0x66af[47]]({where:{id:_0x88cdxc[_0x66af[20]][_0x66af[77]]}})[_0x66af[17]](function(_0x88cdx2d){if(!_0x88cdx2d){return _0x88cdxd[_0x66af[49]](404)};_0x88cdx28= _0x88cdx2d;return CustomField[_0x66af[75]]({where:{id:_0x88cdxc[_0x66af[20]][_0x66af[77]]}})})[_0x66af[17]](function(){return Contact[_0x66af[84]]()})[_0x66af[17]](function(_0x88cdx2c){return _[_0x66af[83]](_0x88cdx2c)})[_0x66af[17]](function(_0x88cdx29){var _0x88cdx2a=[];_0x88cdx28[_0x66af[82]](function(_0x88cdx2b){if(_[_0x66af[79]](_0x88cdx29,_0x88cdx2b[_0x66af[55]])){_0x88cdx2a[_0x66af[81]](sequelize[_0x66af[20]](util[_0x66af[56]](_0x66af[80],_0x88cdx2b[_0x66af[55]])))}});return _0x88cdx2a})[_0x66af[78]]()[_0x66af[17]](function(){return _0x88cdxd[_0x66af[49]](204)})[_0x66af[14]](function(_0x88cdxf){return handleError(_0x88cdxd,_0x88cdxf)})};function handleError(_0x88cdxd,_0x88cdxf){return _0x88cdxd[_0x66af[16]](500)[_0x66af[15]](_0x88cdxf)}