Built motion from commit 4076403.|0.0.87
[motion.git] / server / api / jscripty_project / jscripty_project.controller.js
1 var _0xbf27=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x78\x6D\x6C\x32\x6A\x73","\x6C\x6F\x64\x61\x73\x68","\x4A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\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","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x53\x65\x73\x73\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x51\x75\x65\x73\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x49\x6E\x70\x75\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\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","\x73\x68\x6F\x77\x53\x65\x73\x73\x69\x6F\x6E\x73","\x6C\x6F\x67","\x71\x75\x65\x73\x74\x69\x6F\x6E\x73\x41\x6E\x64\x49\x6E\x70\x75\x74","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77\x53\x65\x73\x73\x69\x6F\x6E","\x73\x65\x73\x73\x69\x6F\x6E\x49\x64","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77\x51\x75\x65\x73\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x77\x53\x75\x6D\x6D\x61\x72\x79","\x71\x75\x65\x73\x74\x69\x6F\x6E\x53\x75\x6D\x6D\x61\x72\x79","\x73\x68\x6F\x77\x44\x65\x74\x61\x69\x6C","\x71\x75\x65\x73\x74\x69\x6F\x6E","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x69\x64","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x6C\x61\x62\x65\x6C","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x74\x65\x78\x74","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x61\x6E\x73\x77\x65\x72","\x63\x6F\x75\x6E\x74","\x63\x6F\x6C","\x66\x6E","\x63\x72\x65\x61\x74\x65","\x6E\x61\x6D\x65","\x66\x69\x65\x6C\x64\x73","\x6D\x65\x73\x73\x61\x67\x65","\x50\x72\x6F\x6A\x65\x63\x74\x20\x6E\x61\x6D\x65\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73","\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\x50\x52\x4F\x4A\x45\x43\x54","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x53\x65\x73\x73\x69\x6F\x6E","\x63\x72\x65\x61\x74\x65\x51\x75\x65\x73\x74\x69\x6F\x6E\x73","\x72\x65\x71\x2E\x62\x6F\x64\x79","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x61\x6C\x6C","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x53\x65\x73\x73\x69\x6F\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x3B\x20\x66\x69\x6C\x65\x6E\x61\x6D\x65\x3D\x22","\x2E\x78\x6D\x6C\x22","\x74\x78\x74\x2F\x78\x6D\x6C","\x73\x65\x74","\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E"];_0xbf27[0];var xml=require(_0xbf27[1]);var _=require(_0xbf27[2]);var JscriptyProject=require(_0xbf27[4])[_0xbf27[3]];var Util=require(_0xbf27[5]);var sequelize=require(_0xbf27[4])[_0xbf27[6]];var ReportJscriptySession=require(_0xbf27[4])[_0xbf27[7]];var ReportJscriptyQuestion=require(_0xbf27[4])[_0xbf27[8]];var ReportJscriptyInput=require(_0xbf27[4])[_0xbf27[9]];var Promise=require(_0xbf27[10]);function handleError(_0xf958xb,_0xf958xc){return _0xf958xb[_0xbf27[12]](500)[_0xbf27[11]](_0xf958xc)}function responseWithResult(_0xf958xb,_0xf958xe){_0xf958xe=_0xf958xe||200;return function(_0xf958xf){if(_0xf958xf){_0xf958xb[_0xbf27[12]](_0xf958xe)[_0xbf27[13]](_0xf958xf)}}}function handleEntityNotFound(_0xf958xb){return function(_0xf958xf){if(!_0xf958xf){_0xf958xb[_0xbf27[12]](404)[_0xbf27[14]]();return null};return _0xf958xf}}function saveUpdates(_0xf958x12){return function(_0xf958xf){return _0xf958xf[_0xbf27[16]](_0xf958x12)[_0xbf27[15]](function(_0xf958x13){return _0xf958x13})}}function removeEntity(_0xf958xb){return function(_0xf958xf){if(_0xf958xf){return _0xf958xf[_0xbf27[17]]()[_0xbf27[15]](function(){_0xf958xb[_0xbf27[12]](204)[_0xbf27[14]]()})}}}exports[_0xbf27[18]]=function(_0xf958x15,_0xf958xb,_0xf958x16){return JscriptyProject[_0xbf27[22]](Util[_0xbf27[21]](_0xf958x15[_0xbf27[20]]))[_0xbf27[15]](function(_0xf958x17){_0xf958xb[_0xbf27[12]](200)[_0xbf27[11]](_0xf958x17)})[_0xbf27[19]](function(_0xf958xc){return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[23]]=function(_0xf958x15,_0xf958xb){return JscriptyProject[_0xbf27[27]](_0xf958x15[_0xbf27[26]][_0xbf27[25]])[_0xbf27[15]](function(_0xf958x18){if(!_0xf958x18){return _0xf958xb[_0xbf27[24]](404)};return _0xf958xb[_0xbf27[11]](_0xf958x18)})[_0xbf27[19]](function(_0xf958xc){return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[28]]=function(_0xf958x15,_0xf958xb){return ReportJscriptySession[_0xbf27[31]]({method:[_0xbf27[30],_0xf958x15[_0xbf27[26]][_0xbf27[25]]]})[_0xbf27[22]](Util[_0xbf27[21]](_0xf958x15[_0xbf27[20]]))[_0xbf27[15]](handleEntityNotFound(_0xf958xb))[_0xbf27[15]](responseWithResult(_0xf958xb))[_0xbf27[19]](function(_0xf958xc){console[_0xbf27[29]](_0xf958xc);return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[32]]=function(_0xf958x15,_0xf958xb){return ReportJscriptySession[_0xbf27[34]]({where:{projectId:_0xf958x15[_0xbf27[26]][_0xbf27[25]],session_id:_0xf958x15[_0xbf27[26]][_0xbf27[33]]},include:[{model:ReportJscriptyQuestion,include:[{model:ReportJscriptyInput}]}]})[_0xbf27[15]](handleEntityNotFound(_0xf958xb))[_0xbf27[15]](responseWithResult(_0xf958xb))[_0xbf27[19]](function(_0xf958xc){console[_0xbf27[29]](_0xf958xc);return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[35]]=function(_0xf958x15,_0xf958xb){return ReportJscriptyQuestion[_0xbf27[34]]({where:{projectId:_0xf958x15[_0xbf27[26]][_0xbf27[25]]},include:[{model:ReportJscriptyInput}]})[_0xbf27[15]](function(_0xf958x19){if(!_0xf958x19){return _0xf958xb[_0xbf27[24]](404)};return _0xf958xb[_0xbf27[12]](200)[_0xbf27[11]](_0xf958x19)})[_0xbf27[15]](handleEntityNotFound(_0xf958xb))[_0xbf27[19]](function(_0xf958xc){console[_0xbf27[29]](_0xf958xc);return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[36]]=function(_0xf958x15,_0xf958xb){return ReportJscriptyQuestion[_0xbf27[31]]({method:[_0xbf27[37],_0xf958x15[_0xbf27[26]][_0xbf27[25]]]})[_0xbf27[22]](Util[_0xbf27[21]](_0xf958x15[_0xbf27[20]]))[_0xbf27[15]](handleEntityNotFound(_0xf958xb))[_0xbf27[15]](function(_0xf958x1a){return _0xf958xb[_0xbf27[12]](200)[_0xbf27[11]](_0xf958x1a)})[_0xbf27[19]](function(_0xf958xc){console[_0xbf27[29]](_0xf958xc);return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[38]]=function(_0xf958x15,_0xf958xb){return ReportJscriptyQuestion[_0xbf27[34]]({where:{projectId:_0xf958x15[_0xbf27[26]][_0xbf27[25]],question_type:_0xbf27[39]},attributes:[_0xbf27[40],_0xbf27[41],_0xbf27[42],_0xbf27[43],[sequelize[_0xbf27[46]](_0xbf27[44],sequelize[_0xbf27[45]](_0xbf27[43])),_0xbf27[44]]],group:[_0xbf27[40],_0xbf27[41],_0xbf27[42],_0xbf27[43]]})[_0xbf27[15]](function(_0xf958x19){return _0xf958xb[_0xbf27[12]](201)[_0xbf27[11]](_0xf958x19)})[_0xbf27[19]](function(_0xf958xc){console[_0xbf27[29]](_0xf958xc);return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[47]]=function(_0xf958x15,_0xf958xb){return JscriptyProject[_0xbf27[47]](_0xf958x15[_0xbf27[54]])[_0xbf27[15]](function(_0xf958x18){return _0xf958xb[_0xbf27[12]](201)[_0xbf27[11]](_0xf958x18)})[_0xbf27[19]](sequelize.UniqueConstraintError,function(_0xf958xc){if(_0xf958xc[_0xbf27[49]][_0xbf27[48]]){_0xf958xc[_0xbf27[50]]=_0xbf27[51];_0xf958xc[_0xbf27[52]]=_0xbf27[53]};return handleError(_0xf958xb,_0xf958xc)})[_0xbf27[19]](function(_0xf958xc){return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[55]]=function(_0xf958x15,_0xf958xb){return ReportJscriptySession[_0xbf27[47]](_0xf958x15[_0xbf27[54]])[_0xbf27[15]](function(_0xf958x1b){return _0xf958xb[_0xbf27[12]](201)[_0xbf27[11]](_0xf958x1b)})[_0xbf27[19]](function(_0xf958xc){return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[56]]=function(_0xf958x15,_0xf958xb){return ReportJscriptyQuestion[_0xbf27[17]]({where:{sessionId:_0xf958x15[_0xbf27[26]][_0xbf27[33]]}})[_0xbf27[15]](function(){console[_0xbf27[29]](_0xbf27[57],_0xf958x15[_0xbf27[54]]);var _0xf958x1d=[];_0xf958x15[_0xbf27[54]][_0xbf27[59]](function(_0xf958x1e){_0xf958x1d[_0xbf27[58]](ReportJscriptyQuestion[_0xbf27[47]](_0xf958x1e,{include:[{model:ReportJscriptyInput}]}))});return Promise[_0xbf27[60]](_0xf958x1d)})[_0xbf27[15]](function(_0xf958x1c){return _0xf958xb[_0xbf27[12]](201)[_0xbf27[11]](_0xf958x1c)})[_0xbf27[19]](function(_0xf958xc){return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[61]]=function(_0xf958x15,_0xf958xb){if(_0xf958x15[_0xbf27[54]][_0xbf27[25]]){delete _0xf958x15[_0xbf27[54]][_0xbf27[25]]};return JscriptyProject[_0xbf27[27]](_0xf958x15[_0xbf27[26]][_0xbf27[25]])[_0xbf27[15]](function(_0xf958x18){if(!_0xf958x18){return _0xf958xb[_0xbf27[24]](404)};var _0xf958x13=_[_0xbf27[62]](_0xf958x18,_0xf958x15[_0xbf27[54]]);return _0xf958x13[_0xbf27[63]]()})[_0xbf27[15]](function(_0xf958x18){return _0xf958xb[_0xbf27[12]](200)[_0xbf27[11]](_0xf958x18)})[_0xbf27[19]](function(_0xf958xc){return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[64]]=function(_0xf958x15,_0xf958xb){return ReportJscriptySession[_0xbf27[61]](_0xf958x15[_0xbf27[54]],{where:{session_id:_0xf958x15[_0xbf27[26]][_0xbf27[33]]}})[_0xbf27[15]](function(_0xf958x1b){return _0xf958xb[_0xbf27[12]](200)[_0xbf27[11]](_0xf958x1b)})[_0xbf27[19]](function(_0xf958xc){return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[17]]=function(_0xf958x15,_0xf958xb){return JscriptyProject[_0xbf27[27]](_0xf958x15[_0xbf27[26]][_0xbf27[25]])[_0xbf27[15]](function(_0xf958x18){if(!_0xf958x18){return _0xf958xb[_0xbf27[24]](404)};return _0xf958x18[_0xbf27[17]]()})[_0xbf27[15]](function(){return _0xf958xb[_0xbf27[24]](204)})[_0xbf27[19]](function(_0xf958xc){return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[65]]=function(_0xf958x15,_0xf958xb){return JscriptyProject[_0xbf27[17]]({where:{id:_0xf958x15[_0xbf27[20]][_0xbf27[66]]},individualHooks:true})[_0xbf27[15]](function(){return _0xf958xb[_0xbf27[24]](204)})[_0xbf27[19]](function(_0xf958xc){return handleError(_0xf958xb,_0xf958xc)})};exports[_0xbf27[67]]=function(_0xf958x15,_0xf958xb,_0xf958x16){return JscriptyProject[_0xbf27[27]](_0xf958x15[_0xbf27[26]][_0xbf27[25]])[_0xbf27[15]](function(_0xf958x18){if(!_0xf958x18){return _0xf958xb[_0xbf27[24]](404)};console[_0xbf27[29]](_0xf958x15[_0xbf27[20]][_0xbf27[68]]);_0xf958xb[_0xbf27[72]]({"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E":_0xbf27[69]+_0xf958x15[_0xbf27[20]][_0xbf27[68]]+_0xbf27[70],"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0xbf27[71]});return _0xf958xb[_0xbf27[11]](_0xf958x18[_0xbf27[73]])})[_0xbf27[19]](function(_0xf958xc){return handleError(_0xf958xb,_0xf958xc)})}