278a0d1f1bef33230c0aa81606c5a6b7c47358a4
[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 _0x8e51=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication','update','body','options','raw','attributes','limit','info','UpdateFaxApplication','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8e51,0x159));var _0x18e5=function(_0x53a20e,_0x2f842f){_0x53a20e=_0x53a20e-0x0;var _0x2ba141=_0x8e51[_0x53a20e];return _0x2ba141;};'use strict';var _=require(_0x18e5('0x0'));var util=require(_0x18e5('0x1'));var moment=require(_0x18e5('0x2'));var BPromise=require(_0x18e5('0x3'));var rs=require(_0x18e5('0x4'));var fs=require('fs');var Redis=require(_0x18e5('0x5'));var db=require(_0x18e5('0x6'))['db'];var utils=require(_0x18e5('0x7'));var logger=require(_0x18e5('0x8'))('rpc');var config=require(_0x18e5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x18e5('0xa')][_0x18e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55ccd9,_0x37502b,_0x1b4477){return new BPromise(function(_0x556be0,_0x4914e3){return client[_0x18e5('0xc')](_0x55ccd9,_0x1b4477)[_0x18e5('0xd')](function(_0x31a37c){logger['info']('FaxApplication,\x20%s,\x20%s',_0x37502b,'request\x20sent');logger['debug'](_0x18e5('0xe'),_0x37502b,'request\x20sent',JSON[_0x18e5('0xf')](_0x31a37c));if(_0x31a37c['error']){if(_0x31a37c[_0x18e5('0x10')][_0x18e5('0x11')]===0x1f4){logger['error'](_0x18e5('0x12'),_0x37502b,_0x31a37c[_0x18e5('0x10')][_0x18e5('0x13')]);return _0x4914e3(_0x31a37c[_0x18e5('0x10')][_0x18e5('0x13')]);}logger[_0x18e5('0x10')](_0x18e5('0x12'),_0x37502b,_0x31a37c[_0x18e5('0x10')][_0x18e5('0x13')]);return _0x556be0(_0x31a37c[_0x18e5('0x10')][_0x18e5('0x13')]);}else{logger['info'](_0x18e5('0x12'),_0x37502b,'request\x20sent');_0x556be0(_0x31a37c[_0x18e5('0x14')][_0x18e5('0x13')]);}})[_0x18e5('0x15')](function(_0x3f8a0f){logger['error']('FaxApplication,\x20%s,\x20%s',_0x37502b,_0x3f8a0f);_0x4914e3(_0x3f8a0f);});});}exports['UpdateFaxApplication']=function(_0x3e7057){var _0xfb9cf8=this;return new Promise(function(_0x4cd1ae,_0x333a10){return db[_0x18e5('0x16')][_0x18e5('0x17')](_0x3e7057[_0x18e5('0x18')],{'raw':_0x3e7057[_0x18e5('0x19')]?_0x3e7057[_0x18e5('0x19')][_0x18e5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e7057[_0x18e5('0x19')]?_0x3e7057['options']['where']||null:null,'attributes':_0x3e7057[_0x18e5('0x19')]?_0x3e7057[_0x18e5('0x19')][_0x18e5('0x1b')]||null:null,'limit':_0x3e7057['options']?_0x3e7057['options'][_0x18e5('0x1c')]||null:null})[_0x18e5('0xd')](function(_0x4e37f7){logger[_0x18e5('0x1d')](_0x18e5('0x1e'),_0x3e7057);logger[_0x18e5('0x1f')]('UpdateFaxApplication',_0x3e7057,JSON[_0x18e5('0xf')](_0x4e37f7));_0x4cd1ae(_0x4e37f7);})[_0x18e5('0x15')](function(_0x3d5f16){logger[_0x18e5('0x10')]('UpdateFaxApplication',_0x3d5f16[_0x18e5('0x13')],_0x3e7057);_0x333a10(_0xfb9cf8['error'](0x1f4,_0x3d5f16[_0x18e5('0x13')]));});});};