Built motion from commit 13c3002c.|2.6.9
[motion2.git] / server / api / squareReport / squareReport.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 _0xbfc3=['result','catch','CreateSquareReport','SquareReport','create','body','options','raw','then','UpdateSquareReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xa3d9a7,_0x1cf219){var _0x48080a=function(_0x43bead){while(--_0x43bead){_0xa3d9a7['push'](_0xa3d9a7['shift']());}};_0x48080a(++_0x1cf219);}(_0xbfc3,0x125));var _0x3bfc=function(_0x2916a0,_0x108aa7){_0x2916a0=_0x2916a0-0x0;var _0x28a905=_0xbfc3[_0x2916a0];return _0x28a905;};'use strict';var _=require(_0x3bfc('0x0'));var util=require(_0x3bfc('0x1'));var moment=require(_0x3bfc('0x2'));var BPromise=require(_0x3bfc('0x3'));var rs=require(_0x3bfc('0x4'));var fs=require('fs');var Redis=require(_0x3bfc('0x5'));var db=require(_0x3bfc('0x6'))['db'];var utils=require(_0x3bfc('0x7'));var logger=require(_0x3bfc('0x8'))(_0x3bfc('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bfc('0xa')][_0x3bfc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25b9b6,_0x5300d8,_0x204cbc){return new BPromise(function(_0x5d7804,_0xa6a544){return client[_0x3bfc('0xc')](_0x25b9b6,_0x204cbc)['then'](function(_0x235bf7){logger[_0x3bfc('0xd')](_0x3bfc('0xe'),_0x5300d8,_0x3bfc('0xf'));logger[_0x3bfc('0x10')](_0x3bfc('0x11'),_0x5300d8,'request\x20sent',JSON[_0x3bfc('0x12')](_0x235bf7));if(_0x235bf7[_0x3bfc('0x13')]){if(_0x235bf7['error'][_0x3bfc('0x14')]===0x1f4){logger[_0x3bfc('0x13')](_0x3bfc('0xe'),_0x5300d8,_0x235bf7['error'][_0x3bfc('0x15')]);return _0xa6a544(_0x235bf7[_0x3bfc('0x13')][_0x3bfc('0x15')]);}logger[_0x3bfc('0x13')](_0x3bfc('0xe'),_0x5300d8,_0x235bf7[_0x3bfc('0x13')][_0x3bfc('0x15')]);return _0x5d7804(_0x235bf7[_0x3bfc('0x13')]['message']);}else{logger[_0x3bfc('0xd')](_0x3bfc('0xe'),_0x5300d8,_0x3bfc('0xf'));_0x5d7804(_0x235bf7[_0x3bfc('0x16')][_0x3bfc('0x15')]);}})[_0x3bfc('0x17')](function(_0x3239af){logger[_0x3bfc('0x13')](_0x3bfc('0xe'),_0x5300d8,_0x3239af);_0xa6a544(_0x3239af);});});}exports[_0x3bfc('0x18')]=function(_0x55758b){var _0x27b0c3=this;return new Promise(function(_0xf0e0fc,_0x341bc7){return db[_0x3bfc('0x19')][_0x3bfc('0x1a')](_0x55758b[_0x3bfc('0x1b')],{'raw':_0x55758b[_0x3bfc('0x1c')]?_0x55758b[_0x3bfc('0x1c')][_0x3bfc('0x1d')]===undefined?!![]:![]:!![]})[_0x3bfc('0x1e')](function(_0x5c0a27){logger[_0x3bfc('0xd')](_0x3bfc('0x18'),_0x55758b);logger[_0x3bfc('0x10')](_0x3bfc('0x18'),_0x55758b,JSON[_0x3bfc('0x12')](_0x5c0a27));_0xf0e0fc(_0x5c0a27);})['catch'](function(_0x431cb6){logger[_0x3bfc('0x13')](_0x3bfc('0x18'),_0x431cb6[_0x3bfc('0x15')],_0x55758b);_0x341bc7(_0x27b0c3[_0x3bfc('0x13')](0x1f4,_0x431cb6[_0x3bfc('0x15')]));});});};exports[_0x3bfc('0x1f')]=function(_0x17f59f){var _0x571a7e=this;return new Promise(function(_0x56e956,_0x1fe812){return db['SquareReport']['update'](_0x17f59f[_0x3bfc('0x1b')],{'raw':_0x17f59f[_0x3bfc('0x1c')]?_0x17f59f['options'][_0x3bfc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17f59f[_0x3bfc('0x1c')]?_0x17f59f[_0x3bfc('0x1c')][_0x3bfc('0x20')]||null:null,'attributes':_0x17f59f[_0x3bfc('0x1c')]?_0x17f59f[_0x3bfc('0x1c')][_0x3bfc('0x21')]||null:null,'limit':_0x17f59f[_0x3bfc('0x1c')]?_0x17f59f['options'][_0x3bfc('0x22')]||null:null})[_0x3bfc('0x1e')](function(_0xa5092a){logger[_0x3bfc('0xd')](_0x3bfc('0x1f'),_0x17f59f);logger[_0x3bfc('0x10')](_0x3bfc('0x1f'),_0x17f59f,JSON[_0x3bfc('0x12')](_0xa5092a));_0x56e956(_0xa5092a);})['catch'](function(_0x188b51){logger['error'](_0x3bfc('0x1f'),_0x188b51[_0x3bfc('0x15')],_0x17f59f);_0x1fe812(_0x571a7e['error'](0x1f4,_0x188b51['message']));});});};