Built motion from commit 3594e56.|0.0.120
[motion.git] / server / api / chat_enquiry / enquiry.controller.js
index 17edcbc..f8e8401 100644 (file)
@@ -1,99 +1 @@
-'use strict';
-
-var _ = require('lodash');
-var ChatEnquiry = require('../../models').ChatEnquiry;
-var ChatVisitor = require('../../models').ChatVisitor;
-
-// Get list of enquirys
-exports.index = function(req, res) {
-  ChatEnquiry
-    .findAll()
-    .then(function(enquirys) {
-      return res.status(200).send(enquirys);
-    })
-    .catch(function(err) {
-      return handleError(res, err);
-    });
-};
-
-// Get a single enquiry
-exports.show = function(req, res) {
-  ChatEnquiry
-    .findOne({
-      where: {
-        id: req.params.id
-      },
-      include: [ChatVisitor]
-    })
-    .then(function(enquiry) {
-      if (!enquiry) {
-        return res.sendStatus(404);
-      }
-      return res.send(enquiry);
-    })
-    .catch(function(err) {
-      return handleError(res, err);
-    });
-};
-
-// Creates a new enquiry in the DB.
-exports.create = function(req, res) {
-  ChatEnquiry
-    .create(req.body)
-    .then(function(enquiry) {
-      return res.status(201).send(enquiry);
-    })
-    .catch(function(err) {
-      return handleError(res, err);
-    });
-};
-
-// Updates an existing enquiry in the DB.
-exports.update = function(req, res) {
-  if (req.body.id) {
-    delete req.body.id;
-  }
-  ChatEnquiry
-    .findById(req.params.id)
-    .then(function(enquiry) {
-      if (!enquiry) {
-        return res.sendStatus(404);
-      }
-      var updated = _.merge(enquiry, req.body);
-      updated.save()
-        .then(function() {
-          return res.status(200).send(enquiry);
-        })
-        .catch(function(err) {
-          return handleError(res, err);
-        });
-    })
-    .catch(function(err) {
-      return handleError(res, err);
-    });
-};
-
-// Deletes a enquiry from the DB.
-exports.destroy = function(req, res) {
-  ChatEnquiry
-    .findById(req.params.id)
-    .then(function(enquiry) {
-      if (!enquiry) {
-        return res.sendStatus(404);
-      }
-      enquiry.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 _0xf6f2=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x43\x68\x61\x74\x45\x6E\x71\x75\x69\x72\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x4C\x69\x73\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","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x69\x64","\x6E\x61\x6D\x65","\x6D\x65\x72\x67\x65","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x65\x72\x72\x6F\x72","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x70\x61\x72\x61\x6D\x73","\x4C\x69\x73\x74\x49\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0xf6f2[0];var _=require(_0xf6f2[1]);var Util=require(_0xf6f2[2]);var ChatEnquiry=require(_0xf6f2[4])[_0xf6f2[3]];var ChatVisitor=require(_0xf6f2[4])[_0xf6f2[5]];var ChatWebsite=require(_0xf6f2[4])[_0xf6f2[6]];var List=require(_0xf6f2[4])[_0xf6f2[7]];exports[_0xf6f2[8]]= function(_0x9bf7x7,_0x9bf7x8,_0x9bf7x9){return ChatEnquiry[_0xf6f2[18]](_[_0xf6f2[17]](Util[_0xf6f2[14]](_0x9bf7x7[_0xf6f2[13]]),{include:[{model:ChatWebsite,attributes:[_0xf6f2[15],_0xf6f2[16]]}]}))[_0xf6f2[12]](function(_0x9bf7xb){return _0x9bf7x8[_0xf6f2[11]](200)[_0xf6f2[10]](_0x9bf7xb)})[_0xf6f2[9]](function(_0x9bf7xa){return handleError(_0x9bf7x8,_0x9bf7xa)})};exports[_0xf6f2[19]]= function(_0x9bf7x7,_0x9bf7x8){return ChatEnquiry[_0xf6f2[24]](_0x9bf7x7[_0xf6f2[22]][_0xf6f2[15]],{include:[{model:ChatWebsite,attributes:[_0xf6f2[15],_0xf6f2[16],_0xf6f2[23]]},{model:ChatVisitor}]})[_0xf6f2[12]](function(_0x9bf7xc){if(!_0x9bf7xc){return _0x9bf7x8[_0xf6f2[21]](404)};return _0x9bf7x8[_0xf6f2[10]](_0x9bf7xc)})[_0xf6f2[9]](function(_0x9bf7xa){console[_0xf6f2[20]](_0x9bf7xa);return handleError(_0x9bf7x8,_0x9bf7xa)})};exports[_0xf6f2[25]]= function(_0x9bf7x7,_0x9bf7x8){return ChatEnquiry[_0xf6f2[25]](_0x9bf7x7[_0xf6f2[26]])[_0xf6f2[12]](function(_0x9bf7xc){return _0x9bf7x8[_0xf6f2[11]](201)[_0xf6f2[10]](_0x9bf7xc)})[_0xf6f2[9]](function(_0x9bf7xa){return handleError(_0x9bf7x8,_0x9bf7xa)})};exports[_0xf6f2[27]]= function(_0x9bf7x7,_0x9bf7x8){if(_0x9bf7x7[_0xf6f2[26]][_0xf6f2[15]]){delete _0x9bf7x7[_0xf6f2[26]][_0xf6f2[15]]};return ChatEnquiry[_0xf6f2[24]](_0x9bf7x7[_0xf6f2[22]][_0xf6f2[15]])[_0xf6f2[12]](function(_0x9bf7xc){if(!_0x9bf7xc){return _0x9bf7x8[_0xf6f2[21]](404)};var _0x9bf7xd=_[_0xf6f2[17]](_0x9bf7xc,_0x9bf7x7[_0xf6f2[26]]);return _0x9bf7xd[_0xf6f2[28]]()})[_0xf6f2[12]](function(_0x9bf7xc){return _0x9bf7x8[_0xf6f2[11]](200)[_0xf6f2[10]](_0x9bf7xc)})[_0xf6f2[9]](function(_0x9bf7xa){return handleError(_0x9bf7x8,_0x9bf7xa)})};exports[_0xf6f2[29]]= function(_0x9bf7x7,_0x9bf7x8){return ChatEnquiry[_0xf6f2[24]](_0x9bf7x7[_0xf6f2[22]][_0xf6f2[15]])[_0xf6f2[12]](function(_0x9bf7xc){if(!_0x9bf7xc){return _0x9bf7x8[_0xf6f2[21]](404)};return _0x9bf7xc[_0xf6f2[29]]()})[_0xf6f2[12]](function(){return _0x9bf7x8[_0xf6f2[21]](204)})[_0xf6f2[9]](function(_0x9bf7xa){return handleError(_0x9bf7x8,_0x9bf7xa)})};exports[_0xf6f2[30]]= function(_0x9bf7x7,_0x9bf7x8){return ChatEnquiry[_0xf6f2[29]]({where:{id:_0x9bf7x7[_0xf6f2[13]][_0xf6f2[31]]},individualHooks:true})[_0xf6f2[12]](function(){return _0x9bf7x8[_0xf6f2[21]](204)})[_0xf6f2[9]](function(_0x9bf7xa){return handleError(_0x9bf7x8,_0x9bf7xa)})};function handleError(_0x9bf7x8,_0x9bf7xa){return _0x9bf7x8[_0xf6f2[11]](500)[_0xf6f2[10]](_0x9bf7xa)}
\ No newline at end of file