7cf35bfdf4f02b643bf978bd4899075d98d86b3d
[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 _0xd52b=['findAll','options','raw','where','attributes','include','map','model','info','debug','catch','error','message','ShowSquareProject','find','stringify','lodash','ioredis','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject'];(function(_0x56dc8c,_0x1b15ca){var _0x166838=function(_0x30257a){while(--_0x30257a){_0x56dc8c['push'](_0x56dc8c['shift']());}};_0x166838(++_0x1b15ca);}(_0xd52b,0x1d0));var _0xbd52=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd52b[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xbd52('0x0'));var Redis=require(_0xbd52('0x1'));var db=require(_0xbd52('0x2'))['db'];var logger=require(_0xbd52('0x3'))(_0xbd52('0x4'));var config=require('../../config/environment');config[_0xbd52('0x5')]=_[_0xbd52('0x6')](config['redis'],{'host':_0xbd52('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd52('0x5')]));require(_0xbd52('0x8'))[_0xbd52('0x9')](socket);exports[_0xbd52('0xa')]=function(_0x3cfb1e){var _0x334d46=this;return new Promise(function(_0x3c3e79,_0x1c84ec){return db[_0xbd52('0xb')][_0xbd52('0xc')]({'raw':_0x3cfb1e[_0xbd52('0xd')]?_0x3cfb1e[_0xbd52('0xd')][_0xbd52('0xe')]===undefined?!![]:![]:!![],'where':_0x3cfb1e[_0xbd52('0xd')]?_0x3cfb1e['options'][_0xbd52('0xf')]||null:null,'attributes':_0x3cfb1e['options']?_0x3cfb1e[_0xbd52('0xd')][_0xbd52('0x10')]||null:null,'limit':_0x3cfb1e[_0xbd52('0xd')]?_0x3cfb1e['options']['limit']||null:null,'include':_0x3cfb1e['options']?_0x3cfb1e[_0xbd52('0xd')][_0xbd52('0x11')]?_[_0xbd52('0x12')](_0x3cfb1e[_0xbd52('0xd')][_0xbd52('0x11')],function(_0x26cb86){return{'model':db[_0x26cb86[_0xbd52('0x13')]],'as':_0x26cb86['as'],'attributes':_0x26cb86[_0xbd52('0x10')],'include':_0x26cb86[_0xbd52('0x11')]?_[_0xbd52('0x12')](_0x26cb86[_0xbd52('0x11')],function(_0x57ce05){return{'model':db[_0x57ce05[_0xbd52('0x13')]],'as':_0x57ce05['as'],'attributes':_0x57ce05[_0xbd52('0x10')],'include':_0x57ce05['include']?_[_0xbd52('0x12')](_0x57ce05[_0xbd52('0x11')],function(_0x5d611f){return{'model':db[_0x5d611f[_0xbd52('0x13')]],'as':_0x5d611f['as'],'attributes':_0x5d611f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x492571){logger[_0xbd52('0x14')](_0xbd52('0xa'),_0x3cfb1e);logger[_0xbd52('0x15')](_0xbd52('0xa'),_0x3cfb1e,JSON['stringify'](_0x492571));_0x3c3e79(_0x492571);})[_0xbd52('0x16')](function(_0x28124c){logger[_0xbd52('0x17')]('GetSquareProjects',_0x28124c[_0xbd52('0x18')],_0x3cfb1e);_0x1c84ec(_0x334d46[_0xbd52('0x17')](0x1f4,_0x28124c[_0xbd52('0x18')]));});});};exports[_0xbd52('0x19')]=function(_0x526e48){var _0x97a444=this;return new Promise(function(_0xa4ea86,_0x225764){return db[_0xbd52('0xb')][_0xbd52('0x1a')]({'raw':_0x526e48[_0xbd52('0xd')]?_0x526e48['options']['raw']===undefined?!![]:![]:!![],'where':_0x526e48[_0xbd52('0xd')]?_0x526e48['options'][_0xbd52('0xf')]||null:null,'attributes':_0x526e48[_0xbd52('0xd')]?_0x526e48[_0xbd52('0xd')][_0xbd52('0x10')]||null:null,'include':_0x526e48['options']?_0x526e48[_0xbd52('0xd')][_0xbd52('0x11')]?_[_0xbd52('0x12')](_0x526e48[_0xbd52('0xd')][_0xbd52('0x11')],function(_0xa7a2c8){return{'model':db[_0xa7a2c8[_0xbd52('0x13')]],'as':_0xa7a2c8['as'],'attributes':_0xa7a2c8[_0xbd52('0x10')],'include':_0xa7a2c8['include']?_[_0xbd52('0x12')](_0xa7a2c8[_0xbd52('0x11')],function(_0x1627a7){return{'model':db[_0x1627a7[_0xbd52('0x13')]],'as':_0x1627a7['as'],'attributes':_0x1627a7[_0xbd52('0x10')],'include':_0x1627a7[_0xbd52('0x11')]?_[_0xbd52('0x12')](_0x1627a7[_0xbd52('0x11')],function(_0x5e23bb){return{'model':db[_0x5e23bb['model']],'as':_0x5e23bb['as'],'attributes':_0x5e23bb[_0xbd52('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56ad92){logger['info'](_0xbd52('0x19'),_0x526e48);logger[_0xbd52('0x15')](_0xbd52('0x19'),_0x526e48,JSON[_0xbd52('0x1b')](_0x56ad92));_0xa4ea86(_0x56ad92);})['catch'](function(_0x14b12d){logger[_0xbd52('0x17')](_0xbd52('0x19'),_0x14b12d['message'],_0x526e48);_0x225764(_0x97a444['error'](0x1f4,_0x14b12d[_0xbd52('0x18')]));});});};