Built motion from commit 4e0bcdd.|0.0.104
[motion.git] / server / api / setting / setting.controller.js
index 4cbb858..15b6227 100644 (file)
@@ -1,152 +1 @@
-'use strict';
-
-var _ = require('lodash');
-var Settings = require('../../models').Settings;
-var Agent = require('../../models').User;
-
-// Get list of settings
-exports.index = function(req, res) {
-  Settings
-    .findAll()
-    .then(function(settings) {
-      return res.status(200).send(settings);
-    })
-    .catch(function(err) {
-      return handleError(res, err);
-    });
-};
-
-// Get list of settings
-exports.getInternal = function(req, res) {
-  Settings
-    .findOne()
-    .then(function(result) {
-      Agent
-        .findAll({
-          where: {
-            internal: {
-              $gte: result.min_internal
-            }
-          }
-        })
-        .then(function(internals) {
-          var pluckdInternals = _.pluck(_.pluck(internals, 'dataValues'), 'internal');
-          var lastChecked = result.min_internal;
-          var internalNumber = {
-            value: null
-          };
-          do {
-            if (pluckdInternals.indexOf(lastChecked) === -1) {
-              internalNumber.value = lastChecked;
-            } else {
-              lastChecked++;
-            }
-          } while (!internalNumber.value)
-          return res.status(200).send(internalNumber);
-        })
-        .catch(function(err) {
-          console.log(err);
-          return handleError(res, err);
-        });
-    })
-    .catch(function(err) {
-      return handleError(res, err);
-    });
-};
-
-// Get list of settings
-exports.getInfo = function(req, res) {
-
-  var info = require('../../../package.json');
-
-  return res.status(200).send({
-    name: info.name,
-    version: info.version,
-    engines: info.engines
-  });
-};
-
-// Get a single setting
-exports.show = function(req, res) {
-  Settings
-    .findById(req.params.id)
-    .then(function(setting) {
-      if (!setting) {
-        return res.sendStatus(404);
-      }
-      return res.send(setting);
-    })
-    .catch(function(err) {
-      return handleError(res, err);
-    });
-};
-
-// Creates a new setting in the DB.
-exports.create = function(req, res) {
-  Settings
-    .create(req.body)
-    .then(function(setting) {
-      return res.status(201).send(setting);
-    })
-    .catch(function(err) {
-      return handleError(res, err);
-    });
-};
-
-// Updates an existing setting in the DB.
-exports.update = function(req, res) {
-  if (req.body.id) {
-    delete req.body.id;
-  }
-  Settings
-    .find({
-      where: {
-        id: req.params.id
-      }
-    })
-    .then(function(setting) {
-      if (!setting) {
-        return res.sendStatus(404);
-      }
-      var updated = _.merge(setting, req.body);
-      updated.save()
-        .then(function() {
-          return res.status(200).send(setting);
-        })
-        .catch(function(err) {
-          return handleError(res, err);
-        });
-    })
-    .catch(function(err) {
-      return handleError(res, err);
-    });
-};
-
-// Deletes a setting from the DB.
-exports.destroy = function(req, res) {
-  Settings
-    .find({
-      where: {
-        id: req.params.id
-      }
-    })
-    .then(function(setting) {
-      if (!setting) {
-        return res.sendStatus(404);
-      }
-      setting.destroy()
-        .then(function() {
-          return res.sendStatus(204);
-        })
-        .catch(function(err) {
-          return handleError(res, err);
-        });
-    })
-    .catch(function(err) {
-      return handleError(res, err);
-    });
-};
-
-function handleError(res, err) {
-  return res.status(500).send(err);
-}
+var _0xf995=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x53\x65\x74\x74\x69\x6E\x67\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x56\x6F\x69\x63\x65\x56\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x67\x65\x74\x49\x6E\x74\x65\x72\x6E\x61\x6C","\x76\x61\x6C\x75\x65","\x6D\x69\x6E\x5F\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x6D\x61\x78","\x66\x69\x6E\x64\x42\x79\x49\x64","\x67\x65\x74\x4D\x61\x69\x6C\x62\x6F\x78","\x6C\x6F\x67","\x6D\x69\x6E\x5F\x6D\x61\x69\x6C\x62\x6F\x78","\x6D\x61\x69\x6C\x62\x6F\x78","\x67\x65\x74\x49\x6E\x66\x6F","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x70\x61\x63\x6B\x61\x67\x65\x2E\x6A\x73\x6F\x6E","\x6E\x61\x6D\x65","\x76\x65\x72\x73\x69\x6F\x6E","\x65\x6E\x67\x69\x6E\x65\x73","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x53\x6D\x74\x70","\x75\x70\x64\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x53\x6D\x74\x70","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0xf995[0];var _=require(_0xf995[1]);var Settings=require(_0xf995[3])[_0xf995[2]];var Agent=require(_0xf995[3])[_0xf995[4]];var VoiceMail=require(_0xf995[3])[_0xf995[5]];var MailServerOut=require(_0xf995[3])[_0xf995[6]];exports[_0xf995[7]]=function(_0x7b53x6,_0x7b53x7){return Settings[_0xf995[12]]()[_0xf995[11]](function(_0x7b53x9){return _0x7b53x7[_0xf995[10]](200)[_0xf995[9]](_0x7b53x9)})[_0xf995[8]](function(_0x7b53x8){return handleError(_0x7b53x7,_0x7b53x8)})};exports[_0xf995[13]]=function(_0x7b53x6,_0x7b53x7){var _0x7b53xa;return Settings[_0xf995[18]](1)[_0xf995[11]](function(_0x7b53x9){_0x7b53xa=_0x7b53x9;return Agent[_0xf995[17]](_0xf995[16])})[_0xf995[11]](function(_0x7b53xb){var _0x7b53xc={value:0};if(_0x7b53xb){_0x7b53xc[_0xf995[14]]= ++_0x7b53xb}else {_0x7b53xc[_0xf995[14]]=_0x7b53xa[_0xf995[15]]};return _0x7b53x7[_0xf995[10]](200)[_0xf995[9]](_0x7b53xc)})[_0xf995[8]](function(_0x7b53x8){return handleError(_0x7b53x7,_0x7b53x8)})};exports[_0xf995[19]]=function(_0x7b53x6,_0x7b53x7){var _0x7b53xa;return Settings[_0xf995[18]](1)[_0xf995[11]](function(_0x7b53x9){_0x7b53xa=_0x7b53x9;return VoiceMail[_0xf995[17]](_0xf995[22])})[_0xf995[11]](function(_0x7b53xd){var _0x7b53xe={value:0};if(_0x7b53xd){_0x7b53xe[_0xf995[14]]= ++_0x7b53xd}else {_0x7b53xe[_0xf995[14]]=_0x7b53xa[_0xf995[21]]};return _0x7b53x7[_0xf995[10]](200)[_0xf995[9]](_0x7b53xe)})[_0xf995[8]](function(_0x7b53x8){console[_0xf995[20]](_0x7b53x8);return handleError(_0x7b53x7,_0x7b53x8)})};exports[_0xf995[23]]=function(_0x7b53x6,_0x7b53x7){var _0x7b53xf=require(_0xf995[24]);return _0x7b53x7[_0xf995[10]](200)[_0xf995[9]]({name:_0x7b53xf[_0xf995[25]],version:_0x7b53xf[_0xf995[26]],engines:_0x7b53xf[_0xf995[27]]})};exports[_0xf995[28]]=function(_0x7b53x6,_0x7b53x7){return Settings[_0xf995[18]](_0x7b53x6[_0xf995[31]][_0xf995[30]])[_0xf995[11]](function(_0x7b53x10){if(!_0x7b53x10){return _0x7b53x7[_0xf995[29]](404)};return _0x7b53x7[_0xf995[9]](_0x7b53x10)})[_0xf995[8]](function(_0x7b53x8){return handleError(_0x7b53x7,_0x7b53x8)})};exports[_0xf995[32]]=function(_0x7b53x6,_0x7b53x7){return Settings[_0xf995[32]](_0x7b53x6[_0xf995[33]])[_0xf995[11]](function(_0x7b53x10){return _0x7b53x7[_0xf995[10]](201)[_0xf995[9]](_0x7b53x10)})[_0xf995[8]](function(_0x7b53x8){return handleError(_0x7b53x7,_0x7b53x8)})};exports[_0xf995[34]]=function(_0x7b53x6,_0x7b53x7){var _0x7b53x11;return MailServerOut[_0xf995[32]](_0x7b53x6[_0xf995[33]])[_0xf995[11]](function(_0x7b53x12){_0x7b53x11=_0x7b53x12;return MailServerOut[_0xf995[35]]({service:false},{where:{id:{$ne:_0x7b53x12[_0xf995[30]]}}})})[_0xf995[11]](function(){return _0x7b53x7[_0xf995[10]](201)[_0xf995[9]](_0x7b53x11)})[_0xf995[8]](function(_0x7b53x8){return handleError(_0x7b53x7,_0x7b53x8)})};exports[_0xf995[36]]=function(_0x7b53x6,_0x7b53x7){return MailServerOut[_0xf995[35]]({service:false},{where:{id:{$ne:_0x7b53x6[_0xf995[33]][_0xf995[30]]}}})[_0xf995[11]](function(){return MailServerOut[_0xf995[35]](_0x7b53x6[_0xf995[33]],{where:{id:_0x7b53x6[_0xf995[33]][_0xf995[30]]}})})[_0xf995[11]](function(_0x7b53x12){return _0x7b53x7[_0xf995[29]](200)})[_0xf995[8]](function(_0x7b53x8){return handleError(_0x7b53x7,_0x7b53x8)})};exports[_0xf995[35]]=function(_0x7b53x6,_0x7b53x7){if(_0x7b53x6[_0xf995[33]][_0xf995[30]]){delete _0x7b53x6[_0xf995[33]][_0xf995[30]]};return Settings[_0xf995[18]](_0x7b53x6[_0xf995[31]][_0xf995[30]])[_0xf995[11]](function(_0x7b53x10){if(!_0x7b53x10){return _0x7b53x7[_0xf995[29]](404)};var _0x7b53x13=_[_0xf995[37]](_0x7b53x10,_0x7b53x6[_0xf995[33]]);return _0x7b53x13[_0xf995[38]]()})[_0xf995[11]](function(_0x7b53x10){return _0x7b53x7[_0xf995[10]](200)[_0xf995[9]](_0x7b53x10)})[_0xf995[8]](function(_0x7b53x8){return handleError(_0x7b53x7,_0x7b53x8)})};exports[_0xf995[39]]=function(_0x7b53x6,_0x7b53x7){return Settings[_0xf995[18]](_0x7b53x6[_0xf995[31]][_0xf995[30]])[_0xf995[11]](function(_0x7b53x10){if(!_0x7b53x10){return _0x7b53x7[_0xf995[29]](404)};return _0x7b53x10[_0xf995[39]]()})[_0xf995[11]](function(){return _0x7b53x7[_0xf995[29]](204)})[_0xf995[8]](function(_0x7b53x8){return handleError(_0x7b53x7,_0x7b53x8)})};function handleError(_0x7b53x7,_0x7b53x8){return _0x7b53x7[_0xf995[10]](500)[_0xf995[9]](_0x7b53x8)}
\ No newline at end of file