c5228132cabad34ac078785cc1281c3b46b236e3
[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 _0xdff6=['defaults','localhost','socket.io-emitter','./squareProject.socket','register','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','info','lodash','rpc','redis'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xdff6,0x1e3));var _0x6dff=function(_0x229c16,_0x46f7de){_0x229c16=_0x229c16-0x0;var _0x119271=_0xdff6[_0x229c16];return _0x119271;};'use strict';var _=require(_0x6dff('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x6dff('0x1'));var config=require('../../config/environment');config[_0x6dff('0x2')]=_[_0x6dff('0x3')](config[_0x6dff('0x2')],{'host':_0x6dff('0x4'),'port':0x18eb});var socket=require(_0x6dff('0x5'))(new Redis(config[_0x6dff('0x2')]));require(_0x6dff('0x6'))[_0x6dff('0x7')](socket);exports['GetSquareProjects']=function(_0x2f9cf9){var _0x5df43f=this;return new Promise(function(_0x3ce03e,_0x37c736){return db[_0x6dff('0x8')][_0x6dff('0x9')]({'raw':_0x2f9cf9[_0x6dff('0xa')]?_0x2f9cf9[_0x6dff('0xa')][_0x6dff('0xb')]===undefined?!![]:![]:!![],'where':_0x2f9cf9[_0x6dff('0xa')]?_0x2f9cf9[_0x6dff('0xa')][_0x6dff('0xc')]||null:null,'attributes':_0x2f9cf9[_0x6dff('0xa')]?_0x2f9cf9[_0x6dff('0xa')][_0x6dff('0xd')]||null:null,'limit':_0x2f9cf9['options']?_0x2f9cf9[_0x6dff('0xa')][_0x6dff('0xe')]||null:null,'include':_0x2f9cf9['options']?_0x2f9cf9['options'][_0x6dff('0xf')]?_[_0x6dff('0x10')](_0x2f9cf9[_0x6dff('0xa')][_0x6dff('0xf')],function(_0x2a7612){return{'model':db[_0x2a7612[_0x6dff('0x11')]],'as':_0x2a7612['as'],'attributes':_0x2a7612[_0x6dff('0xd')],'include':_0x2a7612['include']?_[_0x6dff('0x10')](_0x2a7612[_0x6dff('0xf')],function(_0x284734){return{'model':db[_0x284734[_0x6dff('0x11')]],'as':_0x284734['as'],'attributes':_0x284734[_0x6dff('0xd')],'include':_0x284734['include']?_[_0x6dff('0x10')](_0x284734[_0x6dff('0xf')],function(_0x199503){return{'model':db[_0x199503[_0x6dff('0x11')]],'as':_0x199503['as'],'attributes':_0x199503[_0x6dff('0xd')]};}):[]};}):[]};}):[]:[]})[_0x6dff('0x12')](function(_0x5e097e){logger['info'](_0x6dff('0x13'),_0x2f9cf9);logger[_0x6dff('0x14')](_0x6dff('0x13'),_0x2f9cf9,JSON[_0x6dff('0x15')](_0x5e097e));_0x3ce03e(_0x5e097e);})[_0x6dff('0x16')](function(_0x419095){logger[_0x6dff('0x17')](_0x6dff('0x13'),_0x419095['message'],_0x2f9cf9);_0x37c736(_0x5df43f[_0x6dff('0x17')](0x1f4,_0x419095[_0x6dff('0x18')]));});});};exports[_0x6dff('0x19')]=function(_0x1869d6){var _0x185dc8=this;return new Promise(function(_0x135e65,_0x33852d){return db[_0x6dff('0x8')]['find']({'raw':_0x1869d6[_0x6dff('0xa')]?_0x1869d6[_0x6dff('0xa')][_0x6dff('0xb')]===undefined?!![]:![]:!![],'where':_0x1869d6['options']?_0x1869d6[_0x6dff('0xa')][_0x6dff('0xc')]||null:null,'attributes':_0x1869d6[_0x6dff('0xa')]?_0x1869d6[_0x6dff('0xa')][_0x6dff('0xd')]||null:null,'include':_0x1869d6[_0x6dff('0xa')]?_0x1869d6['options'][_0x6dff('0xf')]?_['map'](_0x1869d6[_0x6dff('0xa')]['include'],function(_0x4d1ad6){return{'model':db[_0x4d1ad6[_0x6dff('0x11')]],'as':_0x4d1ad6['as'],'attributes':_0x4d1ad6[_0x6dff('0xd')],'include':_0x4d1ad6[_0x6dff('0xf')]?_['map'](_0x4d1ad6[_0x6dff('0xf')],function(_0x49a60d){return{'model':db[_0x49a60d[_0x6dff('0x11')]],'as':_0x49a60d['as'],'attributes':_0x49a60d[_0x6dff('0xd')],'include':_0x49a60d[_0x6dff('0xf')]?_[_0x6dff('0x10')](_0x49a60d['include'],function(_0x4bd693){return{'model':db[_0x4bd693[_0x6dff('0x11')]],'as':_0x4bd693['as'],'attributes':_0x4bd693[_0x6dff('0xd')]};}):[]};}):[]};}):[]:[]})[_0x6dff('0x12')](function(_0x47500c){logger[_0x6dff('0x1a')](_0x6dff('0x19'),_0x1869d6);logger[_0x6dff('0x14')](_0x6dff('0x19'),_0x1869d6,JSON['stringify'](_0x47500c));_0x135e65(_0x47500c);})[_0x6dff('0x16')](function(_0x2da6ad){logger[_0x6dff('0x17')]('ShowSquareProject',_0x2da6ad[_0x6dff('0x18')],_0x1869d6);_0x33852d(_0x185dc8[_0x6dff('0x17')](0x1f4,_0x2da6ad[_0x6dff('0x18')]));});});};