Built motion from commit f74363e9.|2.6.34
[motion2.git] / server / api / attachment / attachment.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 _0x32ef=['CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Attachment','create','body','options','raw'];(function(_0x24a632,_0x1d0e83){var _0x1841d1=function(_0x282c4b){while(--_0x282c4b){_0x24a632['push'](_0x24a632['shift']());}};_0x1841d1(++_0x1d0e83);}(_0x32ef,0xf9));var _0xf32e=function(_0x5b4646,_0x44acd3){_0x5b4646=_0x5b4646-0x0;var _0x1e03f2=_0x32ef[_0x5b4646];return _0x1e03f2;};'use strict';var _=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var moment=require(_0xf32e('0x2'));var BPromise=require(_0xf32e('0x3'));var rs=require(_0xf32e('0x4'));var fs=require('fs');var Redis=require(_0xf32e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf32e('0x6'));var logger=require(_0xf32e('0x7'))('rpc');var config=require(_0xf32e('0x8'));var jayson=require(_0xf32e('0x9'));var client=jayson[_0xf32e('0xa')][_0xf32e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xefc0a7,_0x899efc,_0x5aa5c8){return new BPromise(function(_0xdac5e,_0x5b3463){return client[_0xf32e('0xc')](_0xefc0a7,_0x5aa5c8)[_0xf32e('0xd')](function(_0xc37ea7){logger[_0xf32e('0xe')](_0xf32e('0xf'),_0x899efc,'request\x20sent');logger[_0xf32e('0x10')](_0xf32e('0x11'),_0x899efc,_0xf32e('0x12'),JSON[_0xf32e('0x13')](_0xc37ea7));if(_0xc37ea7[_0xf32e('0x14')]){if(_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x15')]===0x1f4){logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x16')]);return _0x5b3463(_0xc37ea7['error'][_0xf32e('0x16')]);}logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x16')]);return _0xdac5e(_0xc37ea7[_0xf32e('0x14')]['message']);}else{logger[_0xf32e('0xe')](_0xf32e('0xf'),_0x899efc,_0xf32e('0x12'));_0xdac5e(_0xc37ea7[_0xf32e('0x17')][_0xf32e('0x16')]);}})[_0xf32e('0x18')](function(_0x6a0231){logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0x6a0231);_0x5b3463(_0x6a0231);});});}exports['CreateAttachment']=function(_0x3510ec){var _0xc47a9=this;return new Promise(function(_0xb828b8,_0x290547){return db[_0xf32e('0x19')][_0xf32e('0x1a')](_0x3510ec[_0xf32e('0x1b')],{'raw':_0x3510ec[_0xf32e('0x1c')]?_0x3510ec[_0xf32e('0x1c')][_0xf32e('0x1d')]===undefined?!![]:![]:!![]})[_0xf32e('0xd')](function(_0x1b169e){logger[_0xf32e('0xe')](_0xf32e('0x1e'),_0x3510ec);logger[_0xf32e('0x10')]('CreateAttachment',_0x3510ec,JSON[_0xf32e('0x13')](_0x1b169e));_0xb828b8(_0x1b169e);})['catch'](function(_0x27b92c){logger[_0xf32e('0x14')](_0xf32e('0x1e'),_0x27b92c[_0xf32e('0x16')],_0x3510ec);_0x290547(_0xc47a9[_0xf32e('0x14')](0x1f4,_0x27b92c['message']));});});};