Built motion from commit a81f050.|0.0.71
[motion.git] / server / api / service / service.controller.js
1 var _0xff7c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x53\x65\x72\x76\x69\x63\x65","\x55\x73\x65\x72\x48\x61\x73\x53\x65\x72\x76\x69\x63\x65","\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","\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","\x67\x65\x74\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73","\x6C\x6F\x67","\x69\x64","\x70\x61\x72\x61\x6D\x73","\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","\x66\x69\x6E\x64\x42\x79\x49\x64","\x75\x70\x64\x61\x74\x65\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x62\x6F\x64\x79","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x63\x72\x65\x61\x74\x65\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x53\x65\x72\x76\x69\x63\x65\x49\x64","\x41\x4C\x54\x45\x52\x20\x54\x41\x42\x4C\x45\x20\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\x53\x45\x52\x56\x49\x43\x45","\x6D\x65\x73\x73\x61\x67\x65","\x54\x68\x65\x20\x73\x65\x72\x76\x69\x63\x65\x20\x6E\x61\x6D\x65\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73","\x75\x70\x64\x61\x74\x65","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x6D\x61\x70","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x61\x67\x65\x6E\x74\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\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","\x61\x6C\x6C","\x41\x4C\x54\x45\x52\x20\x54\x41\x42\x4C\x45\x20\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","\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","\x69\x64\x73"];_0xff7c[0];var _=require(_0xff7c[1]);var util=require(_0xff7c[2]);var User=require(_0xff7c[4])[_0xff7c[3]];var Service=require(_0xff7c[4])[_0xff7c[5]];var UserHasService=require(_0xff7c[4])[_0xff7c[6]];var CustomField=require(_0xff7c[4])[_0xff7c[7]];var Contact=require(_0xff7c[4])[_0xff7c[8]];var Util=require(_0xff7c[9]);var sequelize=require(_0xff7c[4])[_0xff7c[10]];exports[_0xff7c[11]]=function(_0x6f7fxa,_0x6f7fxb,_0x6f7fxc){return Service[_0xff7c[18]](Util[_0xff7c[17]](_0x6f7fxa[_0xff7c[16]]))[_0xff7c[15]](function(_0x6f7fxe){_0x6f7fxb[_0xff7c[14]](200)[_0xff7c[13]](_0x6f7fxe)})[_0xff7c[12]](function(_0x6f7fxd){return handleError(_0x6f7fxb,_0x6f7fxd)})};exports[_0xff7c[19]]=function(_0x6f7fxa,_0x6f7fxb){return CustomField[_0xff7c[18]]({where:{ServiceId:_0x6f7fxa[_0xff7c[22]][_0xff7c[21]],active:true}})[_0xff7c[15]](function(_0x6f7fxf){return _0x6f7fxb[_0xff7c[14]](200)[_0xff7c[13]](_0x6f7fxf)})[_0xff7c[12]](function(_0x6f7fxd){console[_0xff7c[20]](_0x6f7fxd);return handleError(_0x6f7fxb,_0x6f7fxd)})};exports[_0xff7c[23]]=function(_0x6f7fxa,_0x6f7fxb){return CustomField[_0xff7c[25]](_0x6f7fxa[_0xff7c[22]][_0xff7c[21]])[_0xff7c[15]](function(_0x6f7fx10){if(!_0x6f7fx10){return _0x6f7fxb[_0xff7c[24]](404)};return _0x6f7fxb[_0xff7c[14]](200)[_0xff7c[13]](_0x6f7fx10)})[_0xff7c[12]](function(_0x6f7fxd){return handleError(_0x6f7fxb,_0x6f7fxd)})};exports[_0xff7c[26]]=function(_0x6f7fxa,_0x6f7fxb){return CustomField[_0xff7c[25]](_0x6f7fxa[_0xff7c[22]][_0xff7c[21]])[_0xff7c[15]](function(_0x6f7fx10){if(!_0x6f7fx10){return _0x6f7fxb[_0xff7c[24]](404)};var _0x6f7fx11=_[_0xff7c[28]](_0x6f7fx10,_0x6f7fxa[_0xff7c[27]]);return _0x6f7fx11[_0xff7c[29]]()})[_0xff7c[15]](function(_0x6f7fx10){return _0x6f7fxb[_0xff7c[14]](200)[_0xff7c[13]](_0x6f7fx10)})[_0xff7c[12]](function(_0x6f7fxd){return handleError(_0x6f7fxb,_0x6f7fxd)})};exports[_0xff7c[30]]=function(_0x6f7fxa,_0x6f7fxb){var _0x6f7fx12;_0x6f7fxa[_0xff7c[27]][_0xff7c[31]]=_0x6f7fxa[_0xff7c[22]][_0xff7c[21]];return CustomField[_0xff7c[36]](_0x6f7fxa[_0xff7c[27]])[_0xff7c[15]](function(_0x6f7fx10){_0x6f7fx12=_0x6f7fx10;_0x6f7fx10[_0xff7c[33]]=_0xff7c[35]+_0x6f7fx10[_0xff7c[21]];return _0x6f7fx10[_0xff7c[29]]()})[_0xff7c[15]](function(){return sequelize[_0xff7c[16]](util[_0xff7c[34]](_0xff7c[32],_0x6f7fx12[_0xff7c[33]]))})[_0xff7c[15]](function(){return _0x6f7fxb[_0xff7c[24]](201)})[_0xff7c[12]](function(_0x6f7fxd){return handleError(_0x6f7fxb,_0x6f7fxd)})};exports[_0xff7c[37]]=function(_0x6f7fxa,_0x6f7fxb){return Service[_0xff7c[25]](_0x6f7fxa[_0xff7c[22]][_0xff7c[21]])[_0xff7c[15]](function(_0x6f7fx13){if(!_0x6f7fx13){return _0x6f7fxb[_0xff7c[24]](404)};return _0x6f7fxb[_0xff7c[13]](_0x6f7fx13)})[_0xff7c[12]](function(_0x6f7fxd){return handleError(_0x6f7fxb,_0x6f7fxd)})};exports[_0xff7c[36]]=function(_0x6f7fxa,_0x6f7fxb){return Service[_0xff7c[36]](_0x6f7fxa[_0xff7c[27]])[_0xff7c[15]](function(_0x6f7fx13){return _0x6f7fxb[_0xff7c[14]](201)[_0xff7c[13]](_0x6f7fx13)})[_0xff7c[12]](sequelize.UniqueConstraintError,function(_0x6f7fxd){_0x6f7fxd[_0xff7c[38]]=_0xff7c[39];_0x6f7fxd[_0xff7c[40]]=_0xff7c[41];return _0x6f7fxb[_0xff7c[14]](500)[_0xff7c[13]](_0x6f7fxd)})[_0xff7c[12]](function(_0x6f7fxd){return handleError(_0x6f7fxb,_0x6f7fxd)})};exports[_0xff7c[42]]=function(_0x6f7fxa,_0x6f7fxb){return Service[_0xff7c[25]](_0x6f7fxa[_0xff7c[22]][_0xff7c[21]])[_0xff7c[15]](function(_0x6f7fx13){if(!_0x6f7fx13){return _0x6f7fxb[_0xff7c[24]](404)};if(_0x6f7fxa[_0xff7c[27]][_0xff7c[21]]){delete _0x6f7fxa[_0xff7c[27]][_0xff7c[21]]};var _0x6f7fx11=_[_0xff7c[28]](_0x6f7fx13,_0x6f7fxa[_0xff7c[27]]);return _0x6f7fx11[_0xff7c[29]]()})[_0xff7c[15]](function(_0x6f7fx13){return _0x6f7fxb[_0xff7c[14]](200)[_0xff7c[13]](_0x6f7fx13)})[_0xff7c[12]](sequelize.UniqueConstraintError,function(_0x6f7fxd){_0x6f7fxd[_0xff7c[38]]=_0xff7c[39];_0x6f7fxd[_0xff7c[40]]=_0xff7c[41];return _0x6f7fxb[_0xff7c[14]](500)[_0xff7c[13]](_0x6f7fxd)})[_0xff7c[12]](function(_0x6f7fxd){return handleError(_0x6f7fxb,_0x6f7fxd)})};exports[_0xff7c[43]]=function(_0x6f7fxa,_0x6f7fxb){return Service[_0xff7c[25]](_0x6f7fxa[_0xff7c[22]][_0xff7c[21]])[_0xff7c[15]](function(_0x6f7fx13){if(!_0x6f7fx13){return _0x6f7fxb[_0xff7c[24]](404)};return _0x6f7fx13[_0xff7c[47]]({where:{role:_0xff7c[44]},attributes:[_0xff7c[21],_0xff7c[33],_0xff7c[45],_0xff7c[46]]})})[_0xff7c[15]](function(_0x6f7fx14){return _0x6f7fxb[_0xff7c[14]](200)[_0xff7c[13]](_0x6f7fx14)})[_0xff7c[12]](function(_0x6f7fxd){return handleError(_0x6f7fxb,_0x6f7fxd)})};exports[_0xff7c[48]]=function(_0x6f7fxa,_0x6f7fxb,_0x6f7fxc){return User[_0xff7c[52]]({where:{id:_0x6f7fxa[_0xff7c[27]][_0xff7c[51]]}})[_0xff7c[15]](function(_0x6f7fx15){var _0x6f7fx16=_[_0xff7c[49]](_0x6f7fx15,function(_0x6f7fx17){return {service:_0x6f7fxa[_0xff7c[22]][_0xff7c[21]],membername:_0x6f7fx17[_0xff7c[33]],UserId:_0x6f7fx17[_0xff7c[21]]}});return UserHasService[_0xff7c[50]](_0x6f7fx16,{individualHooks:true})})[_0xff7c[15]](function(){return _0x6f7fxb[_0xff7c[24]](200)})[_0xff7c[12]](function(_0x6f7fxd){console[_0xff7c[20]](_0x6f7fxd);return _0x6f7fxc(_0x6f7fxd)})};exports[_0xff7c[53]]=function(_0x6f7fxa,_0x6f7fxb,_0x6f7fxc){return UserHasService[_0xff7c[54]]({where:{UserId:_0x6f7fxa[_0xff7c[16]][_0xff7c[51]],service:_0x6f7fxa[_0xff7c[22]][_0xff7c[21]]},individualHooks:true})[_0xff7c[15]](function(){return _0x6f7fxb[_0xff7c[24]](202)})[_0xff7c[12]](function(_0x6f7fxd){return _0x6f7fxc(_0x6f7fxd)})};exports[_0xff7c[54]]=function(_0x6f7fxa,_0x6f7fxb){return destroyService(_0x6f7fxa[_0xff7c[22]][_0xff7c[21]],_0x6f7fxb)};exports[_0xff7c[55]]=function(_0x6f7fxa,_0x6f7fxb){return destroyService(_0x6f7fxa[_0xff7c[16]][_0xff7c[21]],_0x6f7fxb)};function destroyService(_0x6f7fx19,_0x6f7fxb){return delCf(_0x6f7fx19,_0x6f7fxb)[_0xff7c[56]]()[_0xff7c[15]](function(){return Service[_0xff7c[54]]({where:{id:_0x6f7fx19},individualHooks:true})})[_0xff7c[15]](function(){return _0x6f7fxb[_0xff7c[24]](204)})[_0xff7c[12]](function(_0x6f7fxd){console[_0xff7c[20]](_0x6f7fxd);return handleError(_0x6f7fxb,_0x6f7fxd)})}function delCf(_0x6f7fx19,_0x6f7fxb){var _0x6f7fx1b;return CustomField[_0xff7c[52]]({where:{ServiceId:_0x6f7fx19}})[_0xff7c[15]](function(_0x6f7fx1e){if(!_0x6f7fx1e){return _0x6f7fxb[_0xff7c[24]](404)};_0x6f7fx1b=_0x6f7fx1e;return CustomField[_0xff7c[54]]({where:{id:_0x6f7fx19}})})[_0xff7c[15]](function(){var _0x6f7fx1c=[];_[_0xff7c[59]](_0x6f7fx1b,function(_0x6f7fx1d){_0x6f7fx1c[_0xff7c[58]](sequelize[_0xff7c[16]](util[_0xff7c[34]](_0xff7c[57],_0x6f7fx1d[_0xff7c[33]])))});return _0x6f7fx1c})}exports[_0xff7c[60]]=function(_0x6f7fxa,_0x6f7fxb){var _0x6f7fx1f;return CustomField[_0xff7c[25]](_0x6f7fxa[_0xff7c[22]][_0xff7c[21]])[_0xff7c[15]](function(_0x6f7fx20){if(!_0x6f7fx20){return _0x6f7fxb[_0xff7c[24]](404)};_0x6f7fx1f=_0x6f7fx20;return CustomField[_0xff7c[54]]({where:{id:_0x6f7fxa[_0xff7c[22]][_0xff7c[21]]}})})[_0xff7c[15]](function(){return sequelize[_0xff7c[16]](util[_0xff7c[34]](_0xff7c[57],_0x6f7fx1f[_0xff7c[33]]))})[_0xff7c[15]](function(){return _0x6f7fxb[_0xff7c[24]](204)})[_0xff7c[12]](function(_0x6f7fxd){return handleError(_0x6f7fxb,_0x6f7fxd)})};exports[_0xff7c[61]]=function(_0x6f7fxa,_0x6f7fxb){var _0x6f7fx1b;return CustomField[_0xff7c[52]]({where:{id:_0x6f7fxa[_0xff7c[16]][_0xff7c[62]]}})[_0xff7c[15]](function(_0x6f7fx1e){if(!_0x6f7fx1e){return _0x6f7fxb[_0xff7c[24]](404)};_0x6f7fx1b=_0x6f7fx1e;return CustomField[_0xff7c[54]]({where:{id:_0x6f7fxa[_0xff7c[16]][_0xff7c[62]]}})})[_0xff7c[15]](function(_0x6f7fxf){if(!_0x6f7fxf){return _0x6f7fxb[_0xff7c[24]](404)};var _0x6f7fx1c=[];_0x6f7fx1b[_0xff7c[59]](function(_0x6f7fx1d){_0x6f7fx1c[_0xff7c[58]](sequelize[_0xff7c[16]](util[_0xff7c[34]](_0xff7c[57],_0x6f7fx1d[_0xff7c[33]])))});return _0x6f7fx1c})[_0xff7c[56]]()[_0xff7c[15]](function(){return _0x6f7fxb[_0xff7c[24]](204)})[_0xff7c[12]](function(_0x6f7fxd){return handleError(_0x6f7fxb,_0x6f7fxd)})};function handleError(_0x6f7fxb,_0x6f7fxd){return _0x6f7fxb[_0xff7c[14]](500)[_0xff7c[13]](_0x6f7fxd)}