Built motion from commit 97153652.|2.6.26
[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 _0xf03e=['then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateFaxApplication','update','options','where','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x34b89a,_0x4e8e3a){var _0x4c1721=function(_0x1cced0){while(--_0x1cced0){_0x34b89a['push'](_0x34b89a['shift']());}};_0x4c1721(++_0x4e8e3a);}(_0xf03e,0x114));var _0xef03=function(_0x337866,_0x490b96){_0x337866=_0x337866-0x0;var _0x841789=_0xf03e[_0x337866];return _0x841789;};'use strict';var _=require(_0xef03('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xef03('0x1'));var rs=require(_0xef03('0x2'));var fs=require('fs');var Redis=require(_0xef03('0x3'));var db=require(_0xef03('0x4'))['db'];var utils=require(_0xef03('0x5'));var logger=require('../../config/logger')(_0xef03('0x6'));var config=require('../../config/environment');var jayson=require(_0xef03('0x7'));var client=jayson[_0xef03('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46b4ca,_0x3c8d45,_0xaa144d){return new BPromise(function(_0x998644,_0x40a9ba){return client[_0xef03('0x9')](_0x46b4ca,_0xaa144d)[_0xef03('0xa')](function(_0x16065a){logger[_0xef03('0xb')](_0xef03('0xc'),_0x3c8d45,'request\x20sent');logger[_0xef03('0xd')](_0xef03('0xe'),_0x3c8d45,_0xef03('0xf'),JSON[_0xef03('0x10')](_0x16065a));if(_0x16065a[_0xef03('0x11')]){if(_0x16065a['error']['code']===0x1f4){logger[_0xef03('0x11')](_0xef03('0xc'),_0x3c8d45,_0x16065a[_0xef03('0x11')][_0xef03('0x12')]);return _0x40a9ba(_0x16065a['error'][_0xef03('0x12')]);}logger[_0xef03('0x11')](_0xef03('0xc'),_0x3c8d45,_0x16065a[_0xef03('0x11')][_0xef03('0x12')]);return _0x998644(_0x16065a[_0xef03('0x11')][_0xef03('0x12')]);}else{logger[_0xef03('0xb')](_0xef03('0xc'),_0x3c8d45,_0xef03('0xf'));_0x998644(_0x16065a[_0xef03('0x13')][_0xef03('0x12')]);}})[_0xef03('0x14')](function(_0xa9bb92){logger[_0xef03('0x11')](_0xef03('0xc'),_0x3c8d45,_0xa9bb92);_0x40a9ba(_0xa9bb92);});});}exports[_0xef03('0x15')]=function(_0x46996e){var _0x1fdb03=this;return new Promise(function(_0x1d7c21,_0x233b7c){return db['FaxApplication'][_0xef03('0x16')](_0x46996e['body'],{'raw':_0x46996e['options']?_0x46996e[_0xef03('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46996e[_0xef03('0x17')]?_0x46996e[_0xef03('0x17')][_0xef03('0x18')]||null:null,'attributes':_0x46996e[_0xef03('0x17')]?_0x46996e[_0xef03('0x17')][_0xef03('0x19')]||null:null,'limit':_0x46996e['options']?_0x46996e[_0xef03('0x17')]['limit']||null:null})[_0xef03('0xa')](function(_0x75ff40){logger[_0xef03('0xb')](_0xef03('0x15'),_0x46996e);logger['debug']('UpdateFaxApplication',_0x46996e,JSON['stringify'](_0x75ff40));_0x1d7c21(_0x75ff40);})['catch'](function(_0x1726b3){logger[_0xef03('0x11')](_0xef03('0x15'),_0x1726b3['message'],_0x46996e);_0x233b7c(_0x1fdb03[_0xef03('0x11')](0x1f4,_0x1726b3[_0xef03('0x12')]));});});};