Built motion from commit 58b0471d.|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 _0xf61f=['info','debug','stringify','catch','error','message','ShowSquareProject','ioredis','../../mysqldb','../../config/logger','rpc','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0xd62e94,_0x1fcf16){var _0x2cdeb9=function(_0x147e5f){while(--_0x147e5f){_0xd62e94['push'](_0xd62e94['shift']());}};_0x2cdeb9(++_0x1fcf16);}(_0xf61f,0x77));var _0xff61=function(_0xbc9917,_0x479324){_0xbc9917=_0xbc9917-0x0;var _0x20ab5a=_0xf61f[_0xbc9917];return _0x20ab5a;};'use strict';var _=require('lodash');var Redis=require(_0xff61('0x0'));var db=require(_0xff61('0x1'))['db'];var logger=require(_0xff61('0x2'))(_0xff61('0x3'));var config=require('../../config/environment');config[_0xff61('0x4')]=_[_0xff61('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xff61('0x6'))(new Redis(config['redis']));require(_0xff61('0x7'))[_0xff61('0x8')](socket);exports[_0xff61('0x9')]=function(_0x38784d){var _0x4ecd8c=this;return new Promise(function(_0x4126b4,_0x141c54){return db[_0xff61('0xa')][_0xff61('0xb')]({'raw':_0x38784d[_0xff61('0xc')]?_0x38784d[_0xff61('0xc')][_0xff61('0xd')]===undefined?!![]:![]:!![],'where':_0x38784d[_0xff61('0xc')]?_0x38784d['options'][_0xff61('0xe')]||null:null,'attributes':_0x38784d['options']?_0x38784d[_0xff61('0xc')][_0xff61('0xf')]||null:null,'limit':_0x38784d[_0xff61('0xc')]?_0x38784d[_0xff61('0xc')][_0xff61('0x10')]||null:null,'include':_0x38784d['options']?_0x38784d[_0xff61('0xc')][_0xff61('0x11')]?_['map'](_0x38784d[_0xff61('0xc')][_0xff61('0x11')],function(_0x3c87e7){return{'model':db[_0x3c87e7['model']],'as':_0x3c87e7['as'],'attributes':_0x3c87e7['attributes'],'include':_0x3c87e7[_0xff61('0x11')]?_[_0xff61('0x12')](_0x3c87e7[_0xff61('0x11')],function(_0x393255){return{'model':db[_0x393255[_0xff61('0x13')]],'as':_0x393255['as'],'attributes':_0x393255[_0xff61('0xf')],'include':_0x393255[_0xff61('0x11')]?_[_0xff61('0x12')](_0x393255['include'],function(_0x30b4f5){return{'model':db[_0x30b4f5[_0xff61('0x13')]],'as':_0x30b4f5['as'],'attributes':_0x30b4f5['attributes']};}):[]};}):[]};}):[]:[]})[_0xff61('0x14')](function(_0x231df6){logger[_0xff61('0x15')](_0xff61('0x9'),_0x38784d);logger[_0xff61('0x16')](_0xff61('0x9'),_0x38784d,JSON[_0xff61('0x17')](_0x231df6));_0x4126b4(_0x231df6);})[_0xff61('0x18')](function(_0x648741){logger[_0xff61('0x19')](_0xff61('0x9'),_0x648741[_0xff61('0x1a')],_0x38784d);_0x141c54(_0x4ecd8c[_0xff61('0x19')](0x1f4,_0x648741['message']));});});};exports[_0xff61('0x1b')]=function(_0x2bd041){var _0x5d2f39=this;return new Promise(function(_0x37c94f,_0x2fe8a1){return db[_0xff61('0xa')]['find']({'raw':_0x2bd041[_0xff61('0xc')]?_0x2bd041[_0xff61('0xc')][_0xff61('0xd')]===undefined?!![]:![]:!![],'where':_0x2bd041[_0xff61('0xc')]?_0x2bd041[_0xff61('0xc')][_0xff61('0xe')]||null:null,'attributes':_0x2bd041['options']?_0x2bd041[_0xff61('0xc')][_0xff61('0xf')]||null:null,'include':_0x2bd041[_0xff61('0xc')]?_0x2bd041[_0xff61('0xc')][_0xff61('0x11')]?_[_0xff61('0x12')](_0x2bd041[_0xff61('0xc')][_0xff61('0x11')],function(_0x1212b0){return{'model':db[_0x1212b0['model']],'as':_0x1212b0['as'],'attributes':_0x1212b0['attributes'],'include':_0x1212b0[_0xff61('0x11')]?_['map'](_0x1212b0[_0xff61('0x11')],function(_0xb60767){return{'model':db[_0xb60767[_0xff61('0x13')]],'as':_0xb60767['as'],'attributes':_0xb60767[_0xff61('0xf')],'include':_0xb60767['include']?_['map'](_0xb60767['include'],function(_0x40b44e){return{'model':db[_0x40b44e['model']],'as':_0x40b44e['as'],'attributes':_0x40b44e['attributes']};}):[]};}):[]};}):[]:[]})[_0xff61('0x14')](function(_0x593123){logger[_0xff61('0x15')](_0xff61('0x1b'),_0x2bd041);logger[_0xff61('0x16')](_0xff61('0x1b'),_0x2bd041,JSON['stringify'](_0x593123));_0x37c94f(_0x593123);})[_0xff61('0x18')](function(_0x4bb0d6){logger[_0xff61('0x19')](_0xff61('0x1b'),_0x4bb0d6[_0xff61('0x1a')],_0x2bd041);_0x2fe8a1(_0x5d2f39['error'](0x1f4,_0x4bb0d6[_0xff61('0x1a')]));});});};