Built motion from commit 449495f6.|2.6.27
[motion2.git] / server / api / faxApplication / faxApplication.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 _0x6af2=['request\x20sent','error','code','message','catch','UpdateFaxApplication','FaxApplication','update','options','where','limit','debug','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s'];(function(_0x4e9dd1,_0x23d107){var _0x3ea56b=function(_0x41544a){while(--_0x41544a){_0x4e9dd1['push'](_0x4e9dd1['shift']());}};_0x3ea56b(++_0x23d107);}(_0x6af2,0x1e1));var _0x26af=function(_0x418481,_0x160500){_0x418481=_0x418481-0x0;var _0x522555=_0x6af2[_0x418481];return _0x522555;};'use strict';var _=require(_0x26af('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x26af('0x1'));var rs=require(_0x26af('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26af('0x3'))['db'];var utils=require(_0x26af('0x4'));var logger=require('../../config/logger')(_0x26af('0x5'));var config=require(_0x26af('0x6'));var jayson=require(_0x26af('0x7'));var client=jayson[_0x26af('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bac89,_0x51d9dc,_0x358d59){return new BPromise(function(_0x48ce85,_0x53671c){return client[_0x26af('0x9')](_0x5bac89,_0x358d59)[_0x26af('0xa')](function(_0x42379c){logger[_0x26af('0xb')](_0x26af('0xc'),_0x51d9dc,_0x26af('0xd'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x51d9dc,_0x26af('0xd'),JSON['stringify'](_0x42379c));if(_0x42379c['error']){if(_0x42379c[_0x26af('0xe')][_0x26af('0xf')]===0x1f4){logger[_0x26af('0xe')]('FaxApplication,\x20%s,\x20%s',_0x51d9dc,_0x42379c['error']['message']);return _0x53671c(_0x42379c['error'][_0x26af('0x10')]);}logger[_0x26af('0xe')]('FaxApplication,\x20%s,\x20%s',_0x51d9dc,_0x42379c[_0x26af('0xe')][_0x26af('0x10')]);return _0x48ce85(_0x42379c[_0x26af('0xe')][_0x26af('0x10')]);}else{logger['info'](_0x26af('0xc'),_0x51d9dc,_0x26af('0xd'));_0x48ce85(_0x42379c['result'][_0x26af('0x10')]);}})[_0x26af('0x11')](function(_0x840477){logger[_0x26af('0xe')](_0x26af('0xc'),_0x51d9dc,_0x840477);_0x53671c(_0x840477);});});}exports[_0x26af('0x12')]=function(_0x30e69c){var _0x193ffe=this;return new Promise(function(_0x1634ac,_0x52bfec){return db[_0x26af('0x13')][_0x26af('0x14')](_0x30e69c['body'],{'raw':_0x30e69c[_0x26af('0x15')]?_0x30e69c[_0x26af('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30e69c['options']?_0x30e69c['options'][_0x26af('0x16')]||null:null,'attributes':_0x30e69c['options']?_0x30e69c['options']['attributes']||null:null,'limit':_0x30e69c[_0x26af('0x15')]?_0x30e69c[_0x26af('0x15')][_0x26af('0x17')]||null:null})['then'](function(_0x15b34c){logger['info'](_0x26af('0x12'),_0x30e69c);logger[_0x26af('0x18')]('UpdateFaxApplication',_0x30e69c,JSON[_0x26af('0x19')](_0x15b34c));_0x1634ac(_0x15b34c);})['catch'](function(_0x343f11){logger['error'](_0x26af('0x12'),_0x343f11['message'],_0x30e69c);_0x52bfec(_0x193ffe[_0x26af('0xe')](0x1f4,_0x343f11[_0x26af('0x10')]));});});};