-'use strict';
-
-var _ = require('lodash');
-var FaxRoom = require('../../models').FaxRoom;
-var FaxAccount = require('../../models').FaxAccount;
-var FaxMessage = require('../../models').FaxMessage;
-var Contact = require('../../models').Contact;
-var User = require('../../models').User;
-
-// Get list of fax_rooms
-exports.index = function(req, res) {
- FaxRoom
- .findAll({
- include: [{
- model: FaxMessage,
- attributes: ['id']
- }, {
- model: FaxAccount
- }, {
- model: User
- }]
- })
- .then(function(fax_rooms) {
- return res.status(200).send(fax_rooms);
- })
- .catch(function(err) {
- return handleError(res, err);
- });
-};
-
-// Get list of agent mailRooms
-exports.agentIndex = function(req, res, next) {
- FaxRoom
- .findAll({
- where: {
- UserId: req.params.id
- },
- include: [{
- model: FaxAccount
- }, {
- model: User
- }]
- })
- .then(function(faxRooms) {
- return res.status(200).send(faxRooms);
- })
- .catch(function(err) {
- return next(err);
- });
-};
-
-// Get a single fax_room
-exports.show = function(req, res) {
- FaxRoom
- .findOne({
- where: {
- id: req.params.id
- },
- include: [{
- model: FaxMessage,
- include: [{
- model: FaxRoom,
- include: [{
- model: FaxAccount
- }]
- }, {
- model: Contact,
- as: 'From'
- }, {
- model: Contact,
- as: 'To'
- }]
- }, {
- model: FaxAccount
- }],
- order: [
- [FaxMessage, 'createdAt', 'DESC']
- ]
- })
- .then(function(fax_room) {
- if (!fax_room) {
- return res.sendStatus(404);
- }
- return res.send(fax_room);
- })
- .catch(function(err) {
- return handleError(res, err);
- });
-};
-
-// Creates a new fax_room in the DB.
-exports.create = function(req, res) {
- FaxRoom
- .create(req.body)
- .then(function(fax_room) {
- return res.status(201).send(fax_room);
- })
- .catch(function(err) {
- return handleError(res, err);
- });
-};
-
-// Updates an existing fax_room in the DB.
-exports.update = function(req, res) {
- // if (req.body.id) {
- // delete req.body.id;
- // }
- FaxRoom
- .findById(req.params.id)
- .then(function(fax_room) {
- if (!fax_room) {
- return res.sendStatus(404);
- }
- var updated = _.merge(fax_room, req.body);
- updated.save()
- .then(function() {
- return res.status(200).send(fax_room);
- })
- .catch(function(err) {
- return handleError(res, err);
- });
- })
- .catch(function(err) {
- return handleError(res, err);
- });
-};
-
-// Deletes a fax_room from the DB.
-exports.destroy = function(req, res) {
- FaxRoom
- .findById(req.params.id)
- .then(function(fax_room) {
- if (!fax_room) {
- return res.sendStatus(404);
- }
- fax_room.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 _0x8135=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x46\x61\x78\x52\x6F\x6F\x6D","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x43\x6F\x6E\x74\x61\x63\x74","\x55\x73\x65\x72","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x69\x64","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x67\x65\x6E\x74\x49\x6E\x64\x65\x78","\x70\x61\x72\x61\x6D\x73","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x46\x72\x6F\x6D","\x54\x6F","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x44\x45\x53\x43","\x66\x69\x6E\x64\x4F\x6E\x65","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x66\x69\x6E\x64\x42\x79\x49\x64","\x64\x65\x73\x74\x72\x6F\x79"];_0x8135[0];var _=require(_0x8135[1]);var FaxRoom=require(_0x8135[3])[_0x8135[2]];var FaxAccount=require(_0x8135[3])[_0x8135[4]];var FaxMessage=require(_0x8135[3])[_0x8135[5]];var Contact=require(_0x8135[3])[_0x8135[6]];var User=require(_0x8135[3])[_0x8135[7]];exports[_0x8135[8]]=function(_0x3221x7,_0x3221x8){FaxRoom[_0x8135[14]]({include:[{model:FaxMessage,attributes:[_0x8135[13]]},{model:FaxAccount},{model:User}]})[_0x8135[12]](function(_0x3221xa){return _0x3221x8[_0x8135[11]](200)[_0x8135[10]](_0x3221xa)})[_0x8135[9]](function(_0x3221x9){return handleError(_0x3221x8,_0x3221x9)})};exports[_0x8135[15]]=function(_0x3221x7,_0x3221x8,_0x3221xb){FaxRoom[_0x8135[14]]({where:{UserId:_0x3221x7[_0x8135[16]][_0x8135[13]]},include:[{model:FaxAccount},{model:User}]})[_0x8135[12]](function(_0x3221xc){return _0x3221x8[_0x8135[11]](200)[_0x8135[10]](_0x3221xc)})[_0x8135[9]](function(_0x3221x9){return _0x3221xb(_0x3221x9)})};exports[_0x8135[17]]=function(_0x3221x7,_0x3221x8){FaxRoom[_0x8135[23]]({where:{id:_0x3221x7[_0x8135[16]][_0x8135[13]]},include:[{model:FaxMessage,include:[{model:FaxRoom,include:[{model:FaxAccount}]},{model:Contact,as:_0x8135[19]},{model:Contact,as:_0x8135[20]}]},{model:FaxAccount}],order:[[FaxMessage,_0x8135[21],_0x8135[22]]]})[_0x8135[12]](function(_0x3221xd){if(!_0x3221xd){return _0x3221x8[_0x8135[18]](404)};return _0x3221x8[_0x8135[10]](_0x3221xd);})[_0x8135[9]](function(_0x3221x9){return handleError(_0x3221x8,_0x3221x9)})};exports[_0x8135[24]]=function(_0x3221x7,_0x3221x8){FaxRoom[_0x8135[24]](_0x3221x7[_0x8135[25]])[_0x8135[12]](function(_0x3221xd){return _0x3221x8[_0x8135[11]](201)[_0x8135[10]](_0x3221xd)})[_0x8135[9]](function(_0x3221x9){return handleError(_0x3221x8,_0x3221x9)})};exports[_0x8135[26]]=function(_0x3221x7,_0x3221x8){FaxRoom[_0x8135[29]](_0x3221x7[_0x8135[16]][_0x8135[13]])[_0x8135[12]](function(_0x3221xd){if(!_0x3221xd){return _0x3221x8[_0x8135[18]](404)};var _0x3221xe=_[_0x8135[27]](_0x3221xd,_0x3221x7[_0x8135[25]]);_0x3221xe[_0x8135[28]]()[_0x8135[12]](function(){return _0x3221x8[_0x8135[11]](200)[_0x8135[10]](_0x3221xd)})[_0x8135[9]](function(_0x3221x9){return handleError(_0x3221x8,_0x3221x9)});})[_0x8135[9]](function(_0x3221x9){return handleError(_0x3221x8,_0x3221x9)})};exports[_0x8135[30]]=function(_0x3221x7,_0x3221x8){FaxRoom[_0x8135[29]](_0x3221x7[_0x8135[16]][_0x8135[13]])[_0x8135[12]](function(_0x3221xd){if(!_0x3221xd){return _0x3221x8[_0x8135[18]](404)};_0x3221xd[_0x8135[30]]()[_0x8135[12]](function(){return _0x3221x8[_0x8135[18]](204)})[_0x8135[9]](function(_0x3221x9){return handleError(_0x3221x8,_0x3221x9)});})[_0x8135[9]](function(_0x3221x9){return handleError(_0x3221x8,_0x3221x9)})};function handleError(_0x3221x8,_0x3221x9){return _0x3221x8[_0x8135[11]](500)[_0x8135[10]](_0x3221x9)}
\ No newline at end of file