-'use strict';
-var _ = require('lodash');
-var ChatApplication = require('../../models').ChatApplication;
-// Get list of chat_applications
-exports.index = function(req, res) {
- ChatApplication
- .findAll({
- where: req.query,
- order: 'priority',
- include: [{
- all: true
- }]
- })
- .then(function(chat_applications) {
- return res.status(200).send(chat_applications);
- })
- .catch(function(err) {
- return handleError(res, err);
- });
-};
-// Get a single chat_application
-exports.show = function(req, res) {
- ChatApplication
- .findById(req.params.id)
- .then(function(chat_application) {
- if (!chat_application) {
- return res.sendStatus(404);
- }
- return res.send(chat_application);
- })
- .catch(function(err) {
- return handleError(res, err);
- });
-};
-// Creates a new chat_application in the DB.
-exports.create = function(req, res, next) {
- ChatApplication.max('priority', {
- where: {
- ChatWebsiteId: req.body.ChatWebsiteId
- }
- }).then(function(max) {
- // SET PRIORITY
- req.body.priority = max ? ++max : 1;
- ChatApplication
- .create(req.body)
- .then(function(mailApplication) {
- return res.status(201).send(mailApplication);
- })
- .catch(function(err) {
- return next(err);
- });
- }).catch(function(err) {
- next(err);
- });
-};
-// Updates an existing chat_application in the DB.
-exports.update = function(req, res) {
- if (req.body.id) {
- delete req.body.id;
- }
- ChatApplication
- .findById(req.params.id)
- .then(function(chat_application) {
- if (!chat_application) {
- return res.sendStatus(404);
- }
- var updated = _.merge(chat_application, req.body);
- updated
- .save()
- .then(function() {
- return res.status(200).send(chat_application);
- })
- .catch(function(err) {
- return handleError(res, err);
- });
- })
- .catch(function(err) {
- return handleError(res, err);
- });
-};
-// Deletes a chat_application from the DB.
-exports.destroy = function(req, res) {
- ChatApplication
- .findById(req.params.id)
- .then(function(chat_application) {
- if (!chat_application) {
- return res.sendStatus(404);
- }
- chat_application
- .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 _0x35d6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\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","\x70\x72\x69\x6F\x72\x69\x74\x79","\x66\x69\x6E\x64\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","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x49\x64","\x6D\x61\x78","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x35d6[0];var _=require(_0x35d6[1]);var ChatApplication=require(_0x35d6[3])[_0x35d6[2]];exports[_0x35d6[4]]=function(_0xee1dx3,_0xee1dx4){ChatApplication[_0x35d6[11]]({where:_0xee1dx3[_0x35d6[9]],order:_0x35d6[10],include:[{all:true}]})[_0x35d6[8]](function(_0xee1dx6){return _0xee1dx4[_0x35d6[7]](200)[_0x35d6[6]](_0xee1dx6)})[_0x35d6[5]](function(_0xee1dx5){return handleError(_0xee1dx4,_0xee1dx5)})};exports[_0x35d6[12]]=function(_0xee1dx3,_0xee1dx4){ChatApplication[_0x35d6[16]](_0xee1dx3[_0x35d6[15]][_0x35d6[14]])[_0x35d6[8]](function(_0xee1dx7){if(!_0xee1dx7){return _0xee1dx4[_0x35d6[13]](404)};return _0xee1dx4[_0x35d6[6]](_0xee1dx7);})[_0x35d6[5]](function(_0xee1dx5){return handleError(_0xee1dx4,_0xee1dx5)})};exports[_0x35d6[17]]=function(_0xee1dx3,_0xee1dx4,_0xee1dx8){ChatApplication[_0x35d6[20]](_0x35d6[10],{where:{ChatWebsiteId:_0xee1dx3[_0x35d6[18]][_0x35d6[19]]}})[_0x35d6[8]](function(_0xee1dx9){_0xee1dx3[_0x35d6[18]][_0x35d6[10]]=_0xee1dx9?++_0xee1dx9:1;ChatApplication[_0x35d6[17]](_0xee1dx3[_0x35d6[18]])[_0x35d6[8]](function(_0xee1dxa){return _0xee1dx4[_0x35d6[7]](201)[_0x35d6[6]](_0xee1dxa)})[_0x35d6[5]](function(_0xee1dx5){return _0xee1dx8(_0xee1dx5)});})[_0x35d6[5]](function(_0xee1dx5){_0xee1dx8(_0xee1dx5)})};exports[_0x35d6[21]]=function(_0xee1dx3,_0xee1dx4){if(_0xee1dx3[_0x35d6[18]][_0x35d6[14]]){delete _0xee1dx3[_0x35d6[18]][_0x35d6[14]]};ChatApplication[_0x35d6[16]](_0xee1dx3[_0x35d6[15]][_0x35d6[14]])[_0x35d6[8]](function(_0xee1dx7){if(!_0xee1dx7){return _0xee1dx4[_0x35d6[13]](404)};var _0xee1dxb=_[_0x35d6[22]](_0xee1dx7,_0xee1dx3[_0x35d6[18]]);_0xee1dxb[_0x35d6[23]]()[_0x35d6[8]](function(){return _0xee1dx4[_0x35d6[7]](200)[_0x35d6[6]](_0xee1dx7)})[_0x35d6[5]](function(_0xee1dx5){return handleError(_0xee1dx4,_0xee1dx5)});})[_0x35d6[5]](function(_0xee1dx5){return handleError(_0xee1dx4,_0xee1dx5)});};exports[_0x35d6[24]]=function(_0xee1dx3,_0xee1dx4){ChatApplication[_0x35d6[16]](_0xee1dx3[_0x35d6[15]][_0x35d6[14]])[_0x35d6[8]](function(_0xee1dx7){if(!_0xee1dx7){return _0xee1dx4[_0x35d6[13]](404)};_0xee1dx7[_0x35d6[24]]()[_0x35d6[8]](function(){return _0xee1dx4[_0x35d6[13]](204)})[_0x35d6[5]](function(_0xee1dx5){return handleError(_0xee1dx4,_0xee1dx5)});})[_0x35d6[5]](function(_0xee1dx5){return handleError(_0xee1dx4,_0xee1dx5)})};function handleError(_0xee1dx4,_0xee1dx5){return _0xee1dx4[_0x35d6[7]](500)[_0x35d6[6]](_0xee1dx5)}
\ No newline at end of file