Built motion from commit (unavailable).|2.4.17
[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 _0x890f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','update','body','where','attributes','UpdateFaxMessage','stringify','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3cec10,_0x31c7f3){var _0x2a3b16=function(_0x2839cc){while(--_0x2839cc){_0x3cec10['push'](_0x3cec10['shift']());}};_0x2a3b16(++_0x31c7f3);}(_0x890f,0x1db));var _0xf890=function(_0x4d30c0,_0x3a0ae7){_0x4d30c0=_0x4d30c0-0x0;var _0x5b0c2e=_0x890f[_0x4d30c0];return _0x5b0c2e;};'use strict';var _=require(_0xf890('0x0'));var util=require('util');var moment=require(_0xf890('0x1'));var BPromise=require(_0xf890('0x2'));var rs=require(_0xf890('0x3'));var fs=require('fs');var Redis=require(_0xf890('0x4'));var db=require(_0xf890('0x5'))['db'];var utils=require(_0xf890('0x6'));var logger=require(_0xf890('0x7'))(_0xf890('0x8'));var config=require(_0xf890('0x9'));var jayson=require(_0xf890('0xa'));var client=jayson[_0xf890('0xb')][_0xf890('0xc')]({'port':0x232a});config[_0xf890('0xd')]=_[_0xf890('0xe')](config[_0xf890('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf890('0xf'))(new Redis(config[_0xf890('0xd')]));require('./faxMessage.socket')[_0xf890('0x10')](socket);function respondWithRpcPromise(_0x1aa7db,_0x4b47c1,_0x56fa01){return new BPromise(function(_0x3ddcc9,_0x1e8d74){return client[_0xf890('0x11')](_0x1aa7db,_0x56fa01)[_0xf890('0x12')](function(_0x2764d6){logger[_0xf890('0x13')](_0xf890('0x14'),_0x4b47c1,_0xf890('0x15'));logger[_0xf890('0x16')](_0xf890('0x17'),_0x4b47c1,_0xf890('0x15'),JSON['stringify'](_0x2764d6));if(_0x2764d6['error']){if(_0x2764d6[_0xf890('0x18')][_0xf890('0x19')]===0x1f4){logger[_0xf890('0x18')](_0xf890('0x14'),_0x4b47c1,_0x2764d6[_0xf890('0x18')][_0xf890('0x1a')]);return _0x1e8d74(_0x2764d6['error'][_0xf890('0x1a')]);}logger[_0xf890('0x18')]('FaxMessage,\x20%s,\x20%s',_0x4b47c1,_0x2764d6[_0xf890('0x18')][_0xf890('0x1a')]);return _0x3ddcc9(_0x2764d6[_0xf890('0x18')][_0xf890('0x1a')]);}else{logger[_0xf890('0x13')](_0xf890('0x14'),_0x4b47c1,_0xf890('0x15'));_0x3ddcc9(_0x2764d6[_0xf890('0x1b')][_0xf890('0x1a')]);}})[_0xf890('0x1c')](function(_0x1b7dc9){logger[_0xf890('0x18')](_0xf890('0x14'),_0x4b47c1,_0x1b7dc9);_0x1e8d74(_0x1b7dc9);});});}exports[_0xf890('0x1d')]=function(_0x503bd3){var _0x1d0717=this;return new Promise(function(_0x2d3c7f,_0x9e8a93){return db[_0xf890('0x1e')][_0xf890('0x1f')](_0x503bd3['body'],{'raw':_0x503bd3[_0xf890('0x20')]?_0x503bd3[_0xf890('0x20')][_0xf890('0x21')]===undefined?!![]:![]:!![]})[_0xf890('0x12')](function(_0x126a92){logger['info'](_0xf890('0x1d'),_0x503bd3);logger[_0xf890('0x16')](_0xf890('0x1d'),_0x503bd3,JSON['stringify'](_0x126a92));_0x2d3c7f(_0x126a92);})[_0xf890('0x1c')](function(_0x53e688){logger[_0xf890('0x18')](_0xf890('0x1d'),_0x53e688['message'],_0x503bd3);_0x9e8a93(_0x1d0717[_0xf890('0x18')](0x1f4,_0x53e688['message']));});});};exports['UpdateFaxMessage']=function(_0x2efc1a){var _0x51cb65=this;return new Promise(function(_0xf8b2bd,_0x390ed8){return db[_0xf890('0x1e')][_0xf890('0x22')](_0x2efc1a[_0xf890('0x23')],{'raw':_0x2efc1a[_0xf890('0x20')]?_0x2efc1a[_0xf890('0x20')][_0xf890('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2efc1a[_0xf890('0x20')]?_0x2efc1a[_0xf890('0x20')][_0xf890('0x24')]||null:null,'attributes':_0x2efc1a[_0xf890('0x20')]?_0x2efc1a['options'][_0xf890('0x25')]||null:null,'limit':_0x2efc1a[_0xf890('0x20')]?_0x2efc1a[_0xf890('0x20')]['limit']||null:null})[_0xf890('0x12')](function(_0x8fd7ab){logger['info']('UpdateFaxMessage',_0x2efc1a);logger[_0xf890('0x16')](_0xf890('0x26'),_0x2efc1a,JSON[_0xf890('0x27')](_0x8fd7ab));_0xf8b2bd(_0x8fd7ab);})[_0xf890('0x1c')](function(_0x49425b){logger['error'](_0xf890('0x26'),_0x49425b[_0xf890('0x1a')],_0x2efc1a);_0x390ed8(_0x51cb65['error'](0x1f4,_0x49425b[_0xf890('0x1a')]));});});};