Built motion from commit 67e5df37.|2.0.66
[motion2.git] / server / api / mailDisposition / mailDisposition.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x6c76=['code','message','result','catch','body','options','raw','where','attributes','UpdateMailDisposition','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','MailDisposition,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0x6c76,0x184));var _0x66c7=function(_0x2d76c4,_0x488e53){_0x2d76c4=_0x2d76c4-0x0;var _0x42f3d6=_0x6c76[_0x2d76c4];return _0x42f3d6;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var db=require(_0x66c7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x66c7('0x7')][_0x66c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52f71b,_0x23408c,_0x4dffcd){return new BPromise(function(_0x4fa6ce,_0x208d06){return client[_0x66c7('0x9')](_0x52f71b,_0x4dffcd)[_0x66c7('0xa')](function(_0x53a81c){logger[_0x66c7('0xb')](_0x66c7('0xc'),_0x23408c,_0x66c7('0xd'));logger[_0x66c7('0xe')]('MailDisposition,\x20%s,\x20%s,\x20%s',_0x23408c,_0x66c7('0xd'),JSON[_0x66c7('0xf')](_0x53a81c));if(_0x53a81c[_0x66c7('0x10')]){if(_0x53a81c[_0x66c7('0x10')][_0x66c7('0x11')]===0x1f4){logger[_0x66c7('0x10')](_0x66c7('0xc'),_0x23408c,_0x53a81c['error'][_0x66c7('0x12')]);return _0x208d06(_0x53a81c[_0x66c7('0x10')][_0x66c7('0x12')]);}logger[_0x66c7('0x10')](_0x66c7('0xc'),_0x23408c,_0x53a81c[_0x66c7('0x10')][_0x66c7('0x12')]);return _0x4fa6ce(_0x53a81c[_0x66c7('0x10')][_0x66c7('0x12')]);}else{logger['info'](_0x66c7('0xc'),_0x23408c,'request\x20sent');_0x4fa6ce(_0x53a81c[_0x66c7('0x13')][_0x66c7('0x12')]);}})[_0x66c7('0x14')](function(_0x42e930){logger[_0x66c7('0x10')]('MailDisposition,\x20%s,\x20%s',_0x23408c,_0x42e930);_0x208d06(_0x42e930);});});}exports['UpdateMailDisposition']=function(_0x53fb36){var _0x5129f6=this;return new Promise(function(_0x8ad572,_0x19f29d){return db['MailDisposition']['update'](_0x53fb36[_0x66c7('0x15')],{'raw':_0x53fb36[_0x66c7('0x16')]?_0x53fb36[_0x66c7('0x16')][_0x66c7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53fb36['options']?_0x53fb36['options'][_0x66c7('0x18')]||null:null,'attributes':_0x53fb36[_0x66c7('0x16')]?_0x53fb36[_0x66c7('0x16')][_0x66c7('0x19')]||null:null,'limit':_0x53fb36[_0x66c7('0x16')]?_0x53fb36[_0x66c7('0x16')]['limit']||null:null})[_0x66c7('0xa')](function(_0x366e9b){logger['info'](_0x66c7('0x1a'),_0x53fb36);logger[_0x66c7('0xe')](_0x66c7('0x1a'),_0x53fb36,JSON[_0x66c7('0xf')](_0x366e9b));_0x8ad572(_0x366e9b);})['catch'](function(_0x2736df){logger[_0x66c7('0x10')]('UpdateMailDisposition',_0x2736df[_0x66c7('0x12')],_0x53fb36);_0x19f29d(_0x5129f6[_0x66c7('0x10')](0x1f4,_0x2736df[_0x66c7('0x12')]));});});};