Built motion from commit 3c2ce842.|2.6.31
[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 _0x8b24=['defaults','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','where','lodash','ioredis','../../mysqldb','rpc','redis'];(function(_0xac4d58,_0x43fcc6){var _0x1db8ec=function(_0x3c339c){while(--_0x3c339c){_0xac4d58['push'](_0xac4d58['shift']());}};_0x1db8ec(++_0x43fcc6);}(_0x8b24,0x1c6));var _0x48b2=function(_0x168200,_0x448981){_0x168200=_0x168200-0x0;var _0x43440f=_0x8b24[_0x168200];return _0x43440f;};'use strict';var _=require(_0x48b2('0x0'));var Redis=require(_0x48b2('0x1'));var db=require(_0x48b2('0x2'))['db'];var logger=require('../../config/logger')(_0x48b2('0x3'));var config=require('../../config/environment');config[_0x48b2('0x4')]=_[_0x48b2('0x5')](config[_0x48b2('0x4')],{'host':_0x48b2('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48b2('0x4')]));require(_0x48b2('0x7'))[_0x48b2('0x8')](socket);exports[_0x48b2('0x9')]=function(_0x1ef44f){var _0x843621=this;return new Promise(function(_0x2f1688,_0x46d2ed){return db[_0x48b2('0xa')]['findAll']({'raw':_0x1ef44f[_0x48b2('0xb')]?_0x1ef44f[_0x48b2('0xb')][_0x48b2('0xc')]===undefined?!![]:![]:!![],'where':_0x1ef44f[_0x48b2('0xb')]?_0x1ef44f[_0x48b2('0xb')]['where']||null:null,'attributes':_0x1ef44f['options']?_0x1ef44f[_0x48b2('0xb')][_0x48b2('0xd')]||null:null,'limit':_0x1ef44f['options']?_0x1ef44f[_0x48b2('0xb')][_0x48b2('0xe')]||null:null,'include':_0x1ef44f['options']?_0x1ef44f[_0x48b2('0xb')][_0x48b2('0xf')]?_[_0x48b2('0x10')](_0x1ef44f['options']['include'],function(_0x3172a9){return{'model':db[_0x3172a9[_0x48b2('0x11')]],'as':_0x3172a9['as'],'attributes':_0x3172a9[_0x48b2('0xd')],'include':_0x3172a9['include']?_['map'](_0x3172a9[_0x48b2('0xf')],function(_0x1e92e8){return{'model':db[_0x1e92e8[_0x48b2('0x11')]],'as':_0x1e92e8['as'],'attributes':_0x1e92e8[_0x48b2('0xd')],'include':_0x1e92e8[_0x48b2('0xf')]?_[_0x48b2('0x10')](_0x1e92e8[_0x48b2('0xf')],function(_0x319bcc){return{'model':db[_0x319bcc['model']],'as':_0x319bcc['as'],'attributes':_0x319bcc[_0x48b2('0xd')]};}):[]};}):[]};}):[]:[]})[_0x48b2('0x12')](function(_0x1ebf7b){logger[_0x48b2('0x13')]('GetSquareProjects',_0x1ef44f);logger[_0x48b2('0x14')](_0x48b2('0x9'),_0x1ef44f,JSON[_0x48b2('0x15')](_0x1ebf7b));_0x2f1688(_0x1ebf7b);})[_0x48b2('0x16')](function(_0xa23915){logger['error'](_0x48b2('0x9'),_0xa23915['message'],_0x1ef44f);_0x46d2ed(_0x843621[_0x48b2('0x17')](0x1f4,_0xa23915[_0x48b2('0x18')]));});});};exports[_0x48b2('0x19')]=function(_0x43e30b){var _0x191497=this;return new Promise(function(_0x5f2263,_0x274c59){return db[_0x48b2('0xa')]['find']({'raw':_0x43e30b['options']?_0x43e30b[_0x48b2('0xb')][_0x48b2('0xc')]===undefined?!![]:![]:!![],'where':_0x43e30b[_0x48b2('0xb')]?_0x43e30b[_0x48b2('0xb')][_0x48b2('0x1a')]||null:null,'attributes':_0x43e30b['options']?_0x43e30b[_0x48b2('0xb')][_0x48b2('0xd')]||null:null,'include':_0x43e30b[_0x48b2('0xb')]?_0x43e30b[_0x48b2('0xb')][_0x48b2('0xf')]?_[_0x48b2('0x10')](_0x43e30b['options'][_0x48b2('0xf')],function(_0xd9c915){return{'model':db[_0xd9c915[_0x48b2('0x11')]],'as':_0xd9c915['as'],'attributes':_0xd9c915[_0x48b2('0xd')],'include':_0xd9c915['include']?_[_0x48b2('0x10')](_0xd9c915[_0x48b2('0xf')],function(_0x5be966){return{'model':db[_0x5be966['model']],'as':_0x5be966['as'],'attributes':_0x5be966[_0x48b2('0xd')],'include':_0x5be966[_0x48b2('0xf')]?_[_0x48b2('0x10')](_0x5be966['include'],function(_0x4587c2){return{'model':db[_0x4587c2['model']],'as':_0x4587c2['as'],'attributes':_0x4587c2[_0x48b2('0xd')]};}):[]};}):[]};}):[]:[]})[_0x48b2('0x12')](function(_0x36ea5e){logger[_0x48b2('0x13')](_0x48b2('0x19'),_0x43e30b);logger[_0x48b2('0x14')]('ShowSquareProject',_0x43e30b,JSON['stringify'](_0x36ea5e));_0x5f2263(_0x36ea5e);})[_0x48b2('0x16')](function(_0xa35851){logger['error']('ShowSquareProject',_0xa35851[_0x48b2('0x18')],_0x43e30b);_0x274c59(_0x191497[_0x48b2('0x17')](0x1f4,_0xa35851['message']));});});};