Built motion from commit 013e4bb4.|2.6.18
[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 _0x7b08=['catch','message','ShowSquareProject','find','raw','error','lodash','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','GetSquareProjects','SquareProject','findAll','options','where','attributes','include','map','model','then','info','debug','stringify'];(function(_0x12d44c,_0xf11296){var _0x4fde20=function(_0x3c1ad6){while(--_0x3c1ad6){_0x12d44c['push'](_0x12d44c['shift']());}};_0x4fde20(++_0xf11296);}(_0x7b08,0x13a));var _0x87b0=function(_0x45082c,_0x14883a){_0x45082c=_0x45082c-0x0;var _0x1b1eae=_0x7b08[_0x45082c];return _0x1b1eae;};'use strict';var _=require(_0x87b0('0x0'));var Redis=require(_0x87b0('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x87b0('0x2'))(_0x87b0('0x3'));var config=require(_0x87b0('0x4'));config[_0x87b0('0x5')]=_[_0x87b0('0x6')](config['redis'],{'host':_0x87b0('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87b0('0x5')]));require(_0x87b0('0x8'))['register'](socket);exports[_0x87b0('0x9')]=function(_0x205bbb){var _0x127b12=this;return new Promise(function(_0x4865f1,_0x3b5a30){return db[_0x87b0('0xa')][_0x87b0('0xb')]({'raw':_0x205bbb['options']?_0x205bbb[_0x87b0('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x205bbb[_0x87b0('0xc')]?_0x205bbb[_0x87b0('0xc')][_0x87b0('0xd')]||null:null,'attributes':_0x205bbb[_0x87b0('0xc')]?_0x205bbb[_0x87b0('0xc')][_0x87b0('0xe')]||null:null,'limit':_0x205bbb[_0x87b0('0xc')]?_0x205bbb[_0x87b0('0xc')]['limit']||null:null,'include':_0x205bbb['options']?_0x205bbb['options'][_0x87b0('0xf')]?_[_0x87b0('0x10')](_0x205bbb[_0x87b0('0xc')][_0x87b0('0xf')],function(_0x213317){return{'model':db[_0x213317[_0x87b0('0x11')]],'as':_0x213317['as'],'attributes':_0x213317[_0x87b0('0xe')],'include':_0x213317[_0x87b0('0xf')]?_[_0x87b0('0x10')](_0x213317['include'],function(_0xaded35){return{'model':db[_0xaded35[_0x87b0('0x11')]],'as':_0xaded35['as'],'attributes':_0xaded35[_0x87b0('0xe')],'include':_0xaded35[_0x87b0('0xf')]?_[_0x87b0('0x10')](_0xaded35[_0x87b0('0xf')],function(_0x317b6a){return{'model':db[_0x317b6a[_0x87b0('0x11')]],'as':_0x317b6a['as'],'attributes':_0x317b6a[_0x87b0('0xe')]};}):[]};}):[]};}):[]:[]})[_0x87b0('0x12')](function(_0x2ad02f){logger[_0x87b0('0x13')]('GetSquareProjects',_0x205bbb);logger[_0x87b0('0x14')](_0x87b0('0x9'),_0x205bbb,JSON[_0x87b0('0x15')](_0x2ad02f));_0x4865f1(_0x2ad02f);})[_0x87b0('0x16')](function(_0xd637dc){logger['error'](_0x87b0('0x9'),_0xd637dc[_0x87b0('0x17')],_0x205bbb);_0x3b5a30(_0x127b12['error'](0x1f4,_0xd637dc[_0x87b0('0x17')]));});});};exports[_0x87b0('0x18')]=function(_0x4c4cc4){var _0x43c95d=this;return new Promise(function(_0x415ea7,_0x334e71){return db[_0x87b0('0xa')][_0x87b0('0x19')]({'raw':_0x4c4cc4[_0x87b0('0xc')]?_0x4c4cc4['options'][_0x87b0('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c4cc4['options']?_0x4c4cc4[_0x87b0('0xc')]['where']||null:null,'attributes':_0x4c4cc4['options']?_0x4c4cc4[_0x87b0('0xc')][_0x87b0('0xe')]||null:null,'include':_0x4c4cc4[_0x87b0('0xc')]?_0x4c4cc4[_0x87b0('0xc')][_0x87b0('0xf')]?_['map'](_0x4c4cc4[_0x87b0('0xc')][_0x87b0('0xf')],function(_0x3a18cc){return{'model':db[_0x3a18cc[_0x87b0('0x11')]],'as':_0x3a18cc['as'],'attributes':_0x3a18cc[_0x87b0('0xe')],'include':_0x3a18cc[_0x87b0('0xf')]?_[_0x87b0('0x10')](_0x3a18cc[_0x87b0('0xf')],function(_0x2e4c4e){return{'model':db[_0x2e4c4e['model']],'as':_0x2e4c4e['as'],'attributes':_0x2e4c4e['attributes'],'include':_0x2e4c4e[_0x87b0('0xf')]?_['map'](_0x2e4c4e['include'],function(_0x4b5bfe){return{'model':db[_0x4b5bfe[_0x87b0('0x11')]],'as':_0x4b5bfe['as'],'attributes':_0x4b5bfe[_0x87b0('0xe')]};}):[]};}):[]};}):[]:[]})[_0x87b0('0x12')](function(_0x3825b0){logger[_0x87b0('0x13')](_0x87b0('0x18'),_0x4c4cc4);logger['debug'](_0x87b0('0x18'),_0x4c4cc4,JSON[_0x87b0('0x15')](_0x3825b0));_0x415ea7(_0x3825b0);})['catch'](function(_0x4699ed){logger[_0x87b0('0x1b')]('ShowSquareProject',_0x4699ed['message'],_0x4c4cc4);_0x334e71(_0x43c95d[_0x87b0('0x1b')](0x1f4,_0x4699ed[_0x87b0('0x17')]));});});};