Built motion from commit 0415ced0.|2.6.28
[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 _0x27a6=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','limit','info','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x27a6,0x1bf));var _0x627a=function(_0x6c9b2c,_0x2e1e98){_0x6c9b2c=_0x6c9b2c-0x0;var _0x2dbb9c=_0x27a6[_0x6c9b2c];return _0x2dbb9c;};'use strict';var _=require(_0x627a('0x0'));var util=require(_0x627a('0x1'));var moment=require(_0x627a('0x2'));var BPromise=require(_0x627a('0x3'));var rs=require(_0x627a('0x4'));var fs=require('fs');var Redis=require(_0x627a('0x5'));var db=require(_0x627a('0x6'))['db'];var utils=require(_0x627a('0x7'));var logger=require(_0x627a('0x8'))(_0x627a('0x9'));var config=require(_0x627a('0xa'));var jayson=require(_0x627a('0xb'));var client=jayson[_0x627a('0xc')][_0x627a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x218371,_0x14cca2,_0x42e356){return new BPromise(function(_0x1fe1f5,_0x3496cd){return client[_0x627a('0xe')](_0x218371,_0x42e356)[_0x627a('0xf')](function(_0x5d5262){logger['info'](_0x627a('0x10'),_0x14cca2,_0x627a('0x11'));logger['debug'](_0x627a('0x12'),_0x14cca2,'request\x20sent',JSON[_0x627a('0x13')](_0x5d5262));if(_0x5d5262[_0x627a('0x14')]){if(_0x5d5262[_0x627a('0x14')][_0x627a('0x15')]===0x1f4){logger[_0x627a('0x14')](_0x627a('0x10'),_0x14cca2,_0x5d5262[_0x627a('0x14')][_0x627a('0x16')]);return _0x3496cd(_0x5d5262[_0x627a('0x14')][_0x627a('0x16')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x14cca2,_0x5d5262[_0x627a('0x14')][_0x627a('0x16')]);return _0x1fe1f5(_0x5d5262[_0x627a('0x14')][_0x627a('0x16')]);}else{logger['info'](_0x627a('0x10'),_0x14cca2,_0x627a('0x11'));_0x1fe1f5(_0x5d5262[_0x627a('0x17')][_0x627a('0x16')]);}})[_0x627a('0x18')](function(_0x1457e8){logger[_0x627a('0x14')](_0x627a('0x10'),_0x14cca2,_0x1457e8);_0x3496cd(_0x1457e8);});});}exports[_0x627a('0x19')]=function(_0x161c26){var _0x432330=this;return new Promise(function(_0x5c5e0a,_0x554a2c){return db[_0x627a('0x1a')][_0x627a('0x1b')](_0x161c26[_0x627a('0x1c')],{'raw':_0x161c26[_0x627a('0x1d')]?_0x161c26['options'][_0x627a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x161c26[_0x627a('0x1d')]?_0x161c26['options']['where']||null:null,'attributes':_0x161c26[_0x627a('0x1d')]?_0x161c26['options'][_0x627a('0x1f')]||null:null,'limit':_0x161c26['options']?_0x161c26[_0x627a('0x1d')][_0x627a('0x20')]||null:null})[_0x627a('0xf')](function(_0x364b5e){logger[_0x627a('0x21')](_0x627a('0x19'),_0x161c26);logger[_0x627a('0x22')]('UpdateMailApplication',_0x161c26,JSON['stringify'](_0x364b5e));_0x5c5e0a(_0x364b5e);})[_0x627a('0x18')](function(_0x540bdc){logger[_0x627a('0x14')]('UpdateMailApplication',_0x540bdc[_0x627a('0x16')],_0x161c26);_0x554a2c(_0x432330[_0x627a('0x14')](0x1f4,_0x540bdc[_0x627a('0x16')]));});});};