Built motion from commit (unavailable).|2.5.2
[motion2.git] / server / api / mailApplication / mailApplication.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 _0xf699=['result','catch','UpdateMailApplication','MailApplication','body','options','raw','attributes','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3665b9,_0x3b5d4f){var _0x524099=function(_0x876977){while(--_0x876977){_0x3665b9['push'](_0x3665b9['shift']());}};_0x524099(++_0x3b5d4f);}(_0xf699,0x1e8));var _0x9f69=function(_0x479c35,_0x1052d2){_0x479c35=_0x479c35-0x0;var _0x16bc58=_0xf699[_0x479c35];return _0x16bc58;};'use strict';var _=require(_0x9f69('0x0'));var util=require(_0x9f69('0x1'));var moment=require(_0x9f69('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f69('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9f69('0x4'));var logger=require(_0x9f69('0x5'))(_0x9f69('0x6'));var config=require(_0x9f69('0x7'));var jayson=require(_0x9f69('0x8'));var client=jayson[_0x9f69('0x9')][_0x9f69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d7d05,_0xbe39c4,_0x1861f){return new BPromise(function(_0x3176b8,_0x1308e7){return client[_0x9f69('0xb')](_0x4d7d05,_0x1861f)[_0x9f69('0xc')](function(_0x3b9c36){logger[_0x9f69('0xd')](_0x9f69('0xe'),_0xbe39c4,_0x9f69('0xf'));logger[_0x9f69('0x10')](_0x9f69('0x11'),_0xbe39c4,_0x9f69('0xf'),JSON[_0x9f69('0x12')](_0x3b9c36));if(_0x3b9c36[_0x9f69('0x13')]){if(_0x3b9c36['error'][_0x9f69('0x14')]===0x1f4){logger['error'](_0x9f69('0xe'),_0xbe39c4,_0x3b9c36[_0x9f69('0x13')]['message']);return _0x1308e7(_0x3b9c36[_0x9f69('0x13')]['message']);}logger[_0x9f69('0x13')](_0x9f69('0xe'),_0xbe39c4,_0x3b9c36[_0x9f69('0x13')][_0x9f69('0x15')]);return _0x3176b8(_0x3b9c36[_0x9f69('0x13')][_0x9f69('0x15')]);}else{logger[_0x9f69('0xd')](_0x9f69('0xe'),_0xbe39c4,_0x9f69('0xf'));_0x3176b8(_0x3b9c36[_0x9f69('0x16')][_0x9f69('0x15')]);}})[_0x9f69('0x17')](function(_0x5bca90){logger[_0x9f69('0x13')](_0x9f69('0xe'),_0xbe39c4,_0x5bca90);_0x1308e7(_0x5bca90);});});}exports[_0x9f69('0x18')]=function(_0x3cee03){var _0x5585b5=this;return new Promise(function(_0x17b504,_0x2fcfec){return db[_0x9f69('0x19')]['update'](_0x3cee03[_0x9f69('0x1a')],{'raw':_0x3cee03[_0x9f69('0x1b')]?_0x3cee03[_0x9f69('0x1b')][_0x9f69('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cee03[_0x9f69('0x1b')]?_0x3cee03[_0x9f69('0x1b')]['where']||null:null,'attributes':_0x3cee03[_0x9f69('0x1b')]?_0x3cee03[_0x9f69('0x1b')][_0x9f69('0x1d')]||null:null,'limit':_0x3cee03['options']?_0x3cee03[_0x9f69('0x1b')]['limit']||null:null})[_0x9f69('0xc')](function(_0x35d523){logger[_0x9f69('0xd')](_0x9f69('0x18'),_0x3cee03);logger[_0x9f69('0x10')]('UpdateMailApplication',_0x3cee03,JSON[_0x9f69('0x12')](_0x35d523));_0x17b504(_0x35d523);})[_0x9f69('0x17')](function(_0x303d9e){logger[_0x9f69('0x13')](_0x9f69('0x18'),_0x303d9e[_0x9f69('0x15')],_0x3cee03);_0x2fcfec(_0x5585b5['error'](0x1f4,_0x303d9e[_0x9f69('0x15')]));});});};