Built motion from commit (unavailable).|2.5.20
[motion2.git] / server / api / faxMessage / faxMessage.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 _0xd23a=['attributes','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','debug','UpdateFaxMessage','update','where'];(function(_0x17a334,_0x73961e){var _0x42d679=function(_0x12c3bb){while(--_0x12c3bb){_0x17a334['push'](_0x17a334['shift']());}};_0x42d679(++_0x73961e);}(_0xd23a,0x85));var _0xad23=function(_0x1244f2,_0x364c79){_0x1244f2=_0x1244f2-0x0;var _0x3a61d4=_0xd23a[_0x1244f2];return _0x3a61d4;};'use strict';var _=require(_0xad23('0x0'));var util=require(_0xad23('0x1'));var moment=require(_0xad23('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad23('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xad23('0x4'))(_0xad23('0x5'));var config=require(_0xad23('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xad23('0x7')]['http']({'port':0x232a});config[_0xad23('0x8')]=_[_0xad23('0x9')](config[_0xad23('0x8')],{'host':_0xad23('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xad23('0x8')]));require(_0xad23('0xb'))['register'](socket);function respondWithRpcPromise(_0x286aff,_0x177073,_0x318e97){return new BPromise(function(_0x4a2d52,_0x543ce4){return client['request'](_0x286aff,_0x318e97)[_0xad23('0xc')](function(_0x4705a0){logger[_0xad23('0xd')](_0xad23('0xe'),_0x177073,'request\x20sent');logger['debug'](_0xad23('0xf'),_0x177073,_0xad23('0x10'),JSON[_0xad23('0x11')](_0x4705a0));if(_0x4705a0[_0xad23('0x12')]){if(_0x4705a0[_0xad23('0x12')]['code']===0x1f4){logger[_0xad23('0x12')]('FaxMessage,\x20%s,\x20%s',_0x177073,_0x4705a0[_0xad23('0x12')][_0xad23('0x13')]);return _0x543ce4(_0x4705a0['error'][_0xad23('0x13')]);}logger[_0xad23('0x12')](_0xad23('0xe'),_0x177073,_0x4705a0[_0xad23('0x12')][_0xad23('0x13')]);return _0x4a2d52(_0x4705a0[_0xad23('0x12')][_0xad23('0x13')]);}else{logger[_0xad23('0xd')](_0xad23('0xe'),_0x177073,_0xad23('0x10'));_0x4a2d52(_0x4705a0[_0xad23('0x14')]['message']);}})[_0xad23('0x15')](function(_0x41ef48){logger[_0xad23('0x12')](_0xad23('0xe'),_0x177073,_0x41ef48);_0x543ce4(_0x41ef48);});});}exports[_0xad23('0x16')]=function(_0x3ac427){var _0x4f5fe4=this;return new Promise(function(_0x3abea7,_0x3a84bb){return db[_0xad23('0x17')][_0xad23('0x18')](_0x3ac427[_0xad23('0x19')],{'raw':_0x3ac427[_0xad23('0x1a')]?_0x3ac427[_0xad23('0x1a')][_0xad23('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4e66f4){logger[_0xad23('0xd')]('CreateFaxMessage',_0x3ac427);logger[_0xad23('0x1c')](_0xad23('0x16'),_0x3ac427,JSON[_0xad23('0x11')](_0x4e66f4));_0x3abea7(_0x4e66f4);})['catch'](function(_0x548fc8){logger['error'](_0xad23('0x16'),_0x548fc8[_0xad23('0x13')],_0x3ac427);_0x3a84bb(_0x4f5fe4['error'](0x1f4,_0x548fc8[_0xad23('0x13')]));});});};exports[_0xad23('0x1d')]=function(_0x5c2edf){var _0x23050f=this;return new Promise(function(_0x2a506f,_0xe7de28){return db[_0xad23('0x17')][_0xad23('0x1e')](_0x5c2edf[_0xad23('0x19')],{'raw':_0x5c2edf[_0xad23('0x1a')]?_0x5c2edf[_0xad23('0x1a')][_0xad23('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c2edf[_0xad23('0x1a')]?_0x5c2edf[_0xad23('0x1a')][_0xad23('0x1f')]||null:null,'attributes':_0x5c2edf[_0xad23('0x1a')]?_0x5c2edf[_0xad23('0x1a')][_0xad23('0x20')]||null:null,'limit':_0x5c2edf[_0xad23('0x1a')]?_0x5c2edf[_0xad23('0x1a')]['limit']||null:null})[_0xad23('0xc')](function(_0x519af2){logger['info'](_0xad23('0x1d'),_0x5c2edf);logger[_0xad23('0x1c')](_0xad23('0x1d'),_0x5c2edf,JSON[_0xad23('0x11')](_0x519af2));_0x2a506f(_0x519af2);})['catch'](function(_0x46db7c){logger['error']('UpdateFaxMessage',_0x46db7c['message'],_0x5c2edf);_0xe7de28(_0x23050f[_0xad23('0x12')](0x1f4,_0x46db7c['message']));});});};