Built motion from commit (unavailable).|2.5.17
[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 _0xf577=['where','attributes','UpdateFaxApplication','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','FaxApplication','update','body','options','raw'];(function(_0x512c45,_0x36f294){var _0x53de78=function(_0x4382b7){while(--_0x4382b7){_0x512c45['push'](_0x512c45['shift']());}};_0x53de78(++_0x36f294);}(_0xf577,0x1d2));var _0x7f57=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xf577[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0x7f57('0x0'));var util=require(_0x7f57('0x1'));var moment=require(_0x7f57('0x2'));var BPromise=require(_0x7f57('0x3'));var rs=require(_0x7f57('0x4'));var fs=require('fs');var Redis=require(_0x7f57('0x5'));var db=require(_0x7f57('0x6'))['db'];var utils=require(_0x7f57('0x7'));var logger=require(_0x7f57('0x8'))(_0x7f57('0x9'));var config=require(_0x7f57('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7f57('0xb')][_0x7f57('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xde7ca5,_0x4e0759,_0x4e2f34){return new BPromise(function(_0x97b00a,_0x167f7b){return client[_0x7f57('0xd')](_0xde7ca5,_0x4e2f34)[_0x7f57('0xe')](function(_0x411606){logger['info'](_0x7f57('0xf'),_0x4e0759,'request\x20sent');logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4e0759,_0x7f57('0x10'),JSON[_0x7f57('0x11')](_0x411606));if(_0x411606[_0x7f57('0x12')]){if(_0x411606[_0x7f57('0x12')][_0x7f57('0x13')]===0x1f4){logger[_0x7f57('0x12')](_0x7f57('0xf'),_0x4e0759,_0x411606[_0x7f57('0x12')][_0x7f57('0x14')]);return _0x167f7b(_0x411606[_0x7f57('0x12')][_0x7f57('0x14')]);}logger[_0x7f57('0x12')](_0x7f57('0xf'),_0x4e0759,_0x411606['error'][_0x7f57('0x14')]);return _0x97b00a(_0x411606[_0x7f57('0x12')]['message']);}else{logger[_0x7f57('0x15')]('FaxApplication,\x20%s,\x20%s',_0x4e0759,_0x7f57('0x10'));_0x97b00a(_0x411606[_0x7f57('0x16')]['message']);}})[_0x7f57('0x17')](function(_0x2699e8){logger[_0x7f57('0x12')](_0x7f57('0xf'),_0x4e0759,_0x2699e8);_0x167f7b(_0x2699e8);});});}exports['UpdateFaxApplication']=function(_0x44822f){var _0x43744f=this;return new Promise(function(_0x442130,_0x308884){return db[_0x7f57('0x18')][_0x7f57('0x19')](_0x44822f[_0x7f57('0x1a')],{'raw':_0x44822f[_0x7f57('0x1b')]?_0x44822f[_0x7f57('0x1b')][_0x7f57('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44822f[_0x7f57('0x1b')]?_0x44822f[_0x7f57('0x1b')][_0x7f57('0x1d')]||null:null,'attributes':_0x44822f[_0x7f57('0x1b')]?_0x44822f[_0x7f57('0x1b')][_0x7f57('0x1e')]||null:null,'limit':_0x44822f[_0x7f57('0x1b')]?_0x44822f[_0x7f57('0x1b')]['limit']||null:null})[_0x7f57('0xe')](function(_0x41e77f){logger[_0x7f57('0x15')](_0x7f57('0x1f'),_0x44822f);logger[_0x7f57('0x20')](_0x7f57('0x1f'),_0x44822f,JSON['stringify'](_0x41e77f));_0x442130(_0x41e77f);})['catch'](function(_0x1e6f41){logger[_0x7f57('0x12')](_0x7f57('0x1f'),_0x1e6f41[_0x7f57('0x14')],_0x44822f);_0x308884(_0x43744f[_0x7f57('0x12')](0x1f4,_0x1e6f41[_0x7f57('0x14')]));});});};