Built motion from commit 56b8093a.|2.6.29
[motion2.git] / server / api / squareProject / squareProject.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 _0x2aa7=['model','then','info','debug','catch','message','error','ShowSquareProject','find','stringify','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x2aa7,0x183));var _0x72aa=function(_0x33dfa8,_0x4eb460){_0x33dfa8=_0x33dfa8-0x0;var _0x43c193=_0x2aa7[_0x33dfa8];return _0x43c193;};'use strict';var _=require(_0x72aa('0x0'));var Redis=require(_0x72aa('0x1'));var db=require(_0x72aa('0x2'))['db'];var logger=require(_0x72aa('0x3'))('rpc');var config=require(_0x72aa('0x4'));config[_0x72aa('0x5')]=_['defaults'](config[_0x72aa('0x5')],{'host':_0x72aa('0x6'),'port':0x18eb});var socket=require(_0x72aa('0x7'))(new Redis(config[_0x72aa('0x5')]));require('./squareProject.socket')[_0x72aa('0x8')](socket);exports[_0x72aa('0x9')]=function(_0x3f2735){var _0x1994c5=this;return new Promise(function(_0x8b79ed,_0x3cafdd){return db[_0x72aa('0xa')][_0x72aa('0xb')]({'raw':_0x3f2735[_0x72aa('0xc')]?_0x3f2735[_0x72aa('0xc')][_0x72aa('0xd')]===undefined?!![]:![]:!![],'where':_0x3f2735[_0x72aa('0xc')]?_0x3f2735[_0x72aa('0xc')][_0x72aa('0xe')]||null:null,'attributes':_0x3f2735['options']?_0x3f2735[_0x72aa('0xc')][_0x72aa('0xf')]||null:null,'limit':_0x3f2735[_0x72aa('0xc')]?_0x3f2735[_0x72aa('0xc')][_0x72aa('0x10')]||null:null,'include':_0x3f2735[_0x72aa('0xc')]?_0x3f2735[_0x72aa('0xc')][_0x72aa('0x11')]?_[_0x72aa('0x12')](_0x3f2735['options']['include'],function(_0xc9a2c8){return{'model':db[_0xc9a2c8[_0x72aa('0x13')]],'as':_0xc9a2c8['as'],'attributes':_0xc9a2c8['attributes'],'include':_0xc9a2c8[_0x72aa('0x11')]?_[_0x72aa('0x12')](_0xc9a2c8[_0x72aa('0x11')],function(_0x13469b){return{'model':db[_0x13469b[_0x72aa('0x13')]],'as':_0x13469b['as'],'attributes':_0x13469b['attributes'],'include':_0x13469b[_0x72aa('0x11')]?_[_0x72aa('0x12')](_0x13469b[_0x72aa('0x11')],function(_0x359e23){return{'model':db[_0x359e23[_0x72aa('0x13')]],'as':_0x359e23['as'],'attributes':_0x359e23[_0x72aa('0xf')]};}):[]};}):[]};}):[]:[]})[_0x72aa('0x14')](function(_0x51b481){logger[_0x72aa('0x15')](_0x72aa('0x9'),_0x3f2735);logger[_0x72aa('0x16')](_0x72aa('0x9'),_0x3f2735,JSON['stringify'](_0x51b481));_0x8b79ed(_0x51b481);})[_0x72aa('0x17')](function(_0x41d240){logger['error'](_0x72aa('0x9'),_0x41d240[_0x72aa('0x18')],_0x3f2735);_0x3cafdd(_0x1994c5[_0x72aa('0x19')](0x1f4,_0x41d240[_0x72aa('0x18')]));});});};exports[_0x72aa('0x1a')]=function(_0x35ca70){var _0x116abb=this;return new Promise(function(_0x3a4d26,_0x22e4ea){return db[_0x72aa('0xa')][_0x72aa('0x1b')]({'raw':_0x35ca70['options']?_0x35ca70[_0x72aa('0xc')][_0x72aa('0xd')]===undefined?!![]:![]:!![],'where':_0x35ca70['options']?_0x35ca70[_0x72aa('0xc')]['where']||null:null,'attributes':_0x35ca70[_0x72aa('0xc')]?_0x35ca70['options'][_0x72aa('0xf')]||null:null,'include':_0x35ca70['options']?_0x35ca70[_0x72aa('0xc')][_0x72aa('0x11')]?_[_0x72aa('0x12')](_0x35ca70['options'][_0x72aa('0x11')],function(_0x532abc){return{'model':db[_0x532abc[_0x72aa('0x13')]],'as':_0x532abc['as'],'attributes':_0x532abc[_0x72aa('0xf')],'include':_0x532abc[_0x72aa('0x11')]?_[_0x72aa('0x12')](_0x532abc['include'],function(_0x1dc710){return{'model':db[_0x1dc710['model']],'as':_0x1dc710['as'],'attributes':_0x1dc710[_0x72aa('0xf')],'include':_0x1dc710[_0x72aa('0x11')]?_[_0x72aa('0x12')](_0x1dc710[_0x72aa('0x11')],function(_0x3e5724){return{'model':db[_0x3e5724['model']],'as':_0x3e5724['as'],'attributes':_0x3e5724['attributes']};}):[]};}):[]};}):[]:[]})[_0x72aa('0x14')](function(_0x4fd445){logger[_0x72aa('0x15')](_0x72aa('0x1a'),_0x35ca70);logger['debug'](_0x72aa('0x1a'),_0x35ca70,JSON[_0x72aa('0x1c')](_0x4fd445));_0x3a4d26(_0x4fd445);})[_0x72aa('0x17')](function(_0x407f76){logger['error'](_0x72aa('0x1a'),_0x407f76[_0x72aa('0x18')],_0x35ca70);_0x22e4ea(_0x116abb[_0x72aa('0x19')](0x1f4,_0x407f76[_0x72aa('0x18')]));});});};