Built motion from commit (unavailable).|2.5.4
[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 _0x42f8=['options','raw','UpdateSquareReport','update','body','where','attributes','limit','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create'];(function(_0x36a2ed,_0x3815d4){var _0x2b7be4=function(_0x19a0e4){while(--_0x19a0e4){_0x36a2ed['push'](_0x36a2ed['shift']());}};_0x2b7be4(++_0x3815d4);}(_0x42f8,0x1d0));var _0x842f=function(_0x5d4765,_0x23cb35){_0x5d4765=_0x5d4765-0x0;var _0x41d345=_0x42f8[_0x5d4765];return _0x41d345;};'use strict';var _=require(_0x842f('0x0'));var util=require(_0x842f('0x1'));var moment=require(_0x842f('0x2'));var BPromise=require(_0x842f('0x3'));var rs=require(_0x842f('0x4'));var fs=require('fs');var Redis=require(_0x842f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x842f('0x6'));var logger=require('../../config/logger')(_0x842f('0x7'));var config=require('../../config/environment');var jayson=require(_0x842f('0x8'));var client=jayson[_0x842f('0x9')][_0x842f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x527828,_0x3486ea,_0x5cd959){return new BPromise(function(_0x315534,_0x35a1f8){return client[_0x842f('0xb')](_0x527828,_0x5cd959)[_0x842f('0xc')](function(_0x192d95){logger['info'](_0x842f('0xd'),_0x3486ea,_0x842f('0xe'));logger[_0x842f('0xf')](_0x842f('0x10'),_0x3486ea,'request\x20sent',JSON[_0x842f('0x11')](_0x192d95));if(_0x192d95['error']){if(_0x192d95[_0x842f('0x12')][_0x842f('0x13')]===0x1f4){logger[_0x842f('0x12')](_0x842f('0xd'),_0x3486ea,_0x192d95[_0x842f('0x12')][_0x842f('0x14')]);return _0x35a1f8(_0x192d95[_0x842f('0x12')][_0x842f('0x14')]);}logger[_0x842f('0x12')](_0x842f('0xd'),_0x3486ea,_0x192d95['error'][_0x842f('0x14')]);return _0x315534(_0x192d95[_0x842f('0x12')][_0x842f('0x14')]);}else{logger['info'](_0x842f('0xd'),_0x3486ea,_0x842f('0xe'));_0x315534(_0x192d95[_0x842f('0x15')][_0x842f('0x14')]);}})[_0x842f('0x16')](function(_0x1a827a){logger[_0x842f('0x12')](_0x842f('0xd'),_0x3486ea,_0x1a827a);_0x35a1f8(_0x1a827a);});});}exports[_0x842f('0x17')]=function(_0x7b107c){var _0x3da415=this;return new Promise(function(_0x5bfecc,_0x4378d2){return db[_0x842f('0x18')][_0x842f('0x19')](_0x7b107c['body'],{'raw':_0x7b107c[_0x842f('0x1a')]?_0x7b107c[_0x842f('0x1a')][_0x842f('0x1b')]===undefined?!![]:![]:!![]})[_0x842f('0xc')](function(_0x2424ca){logger['info'](_0x842f('0x17'),_0x7b107c);logger[_0x842f('0xf')](_0x842f('0x17'),_0x7b107c,JSON[_0x842f('0x11')](_0x2424ca));_0x5bfecc(_0x2424ca);})[_0x842f('0x16')](function(_0x2c4c8c){logger[_0x842f('0x12')]('CreateSquareReport',_0x2c4c8c['message'],_0x7b107c);_0x4378d2(_0x3da415[_0x842f('0x12')](0x1f4,_0x2c4c8c[_0x842f('0x14')]));});});};exports[_0x842f('0x1c')]=function(_0x134795){var _0x418c1c=this;return new Promise(function(_0xc007da,_0x41d152){return db[_0x842f('0x18')][_0x842f('0x1d')](_0x134795[_0x842f('0x1e')],{'raw':_0x134795['options']?_0x134795[_0x842f('0x1a')][_0x842f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x134795['options']?_0x134795[_0x842f('0x1a')][_0x842f('0x1f')]||null:null,'attributes':_0x134795[_0x842f('0x1a')]?_0x134795[_0x842f('0x1a')][_0x842f('0x20')]||null:null,'limit':_0x134795[_0x842f('0x1a')]?_0x134795['options'][_0x842f('0x21')]||null:null})['then'](function(_0x4b96c9){logger[_0x842f('0x22')]('UpdateSquareReport',_0x134795);logger['debug'](_0x842f('0x1c'),_0x134795,JSON[_0x842f('0x11')](_0x4b96c9));_0xc007da(_0x4b96c9);})['catch'](function(_0x4ac1a4){logger[_0x842f('0x12')]('UpdateSquareReport',_0x4ac1a4[_0x842f('0x14')],_0x134795);_0x41d152(_0x418c1c[_0x842f('0x12')](0x1f4,_0x4ac1a4[_0x842f('0x14')]));});});};