Built motion from commit ff78e754.|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 _0xa172=['lodash','ioredis','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','SquareProject','findAll','options','raw','where','limit','include','model','attributes','map','info','GetSquareProjects','stringify','catch','message','error','ShowSquareProject','find','then'];(function(_0x1abb64,_0x281460){var _0x3a1ce0=function(_0x4e0ec2){while(--_0x4e0ec2){_0x1abb64['push'](_0x1abb64['shift']());}};_0x3a1ce0(++_0x281460);}(_0xa172,0x105));var _0x2a17=function(_0xde6897,_0x32207b){_0xde6897=_0xde6897-0x0;var _0x109eed=_0xa172[_0xde6897];return _0x109eed;};'use strict';var _=require(_0x2a17('0x0'));var Redis=require(_0x2a17('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x2a17('0x2'));var config=require(_0x2a17('0x3'));config[_0x2a17('0x4')]=_[_0x2a17('0x5')](config[_0x2a17('0x4')],{'host':_0x2a17('0x6'),'port':0x18eb});var socket=require(_0x2a17('0x7'))(new Redis(config[_0x2a17('0x4')]));require(_0x2a17('0x8'))[_0x2a17('0x9')](socket);exports['GetSquareProjects']=function(_0x5efd08){var _0xeb2e60=this;return new Promise(function(_0xb71902,_0x1a3592){return db[_0x2a17('0xa')][_0x2a17('0xb')]({'raw':_0x5efd08[_0x2a17('0xc')]?_0x5efd08[_0x2a17('0xc')][_0x2a17('0xd')]===undefined?!![]:![]:!![],'where':_0x5efd08['options']?_0x5efd08['options'][_0x2a17('0xe')]||null:null,'attributes':_0x5efd08[_0x2a17('0xc')]?_0x5efd08['options']['attributes']||null:null,'limit':_0x5efd08[_0x2a17('0xc')]?_0x5efd08[_0x2a17('0xc')][_0x2a17('0xf')]||null:null,'include':_0x5efd08[_0x2a17('0xc')]?_0x5efd08[_0x2a17('0xc')][_0x2a17('0x10')]?_['map'](_0x5efd08[_0x2a17('0xc')][_0x2a17('0x10')],function(_0x255db7){return{'model':db[_0x255db7[_0x2a17('0x11')]],'as':_0x255db7['as'],'attributes':_0x255db7[_0x2a17('0x12')],'include':_0x255db7[_0x2a17('0x10')]?_[_0x2a17('0x13')](_0x255db7[_0x2a17('0x10')],function(_0x481df8){return{'model':db[_0x481df8[_0x2a17('0x11')]],'as':_0x481df8['as'],'attributes':_0x481df8[_0x2a17('0x12')],'include':_0x481df8['include']?_['map'](_0x481df8[_0x2a17('0x10')],function(_0x306b52){return{'model':db[_0x306b52[_0x2a17('0x11')]],'as':_0x306b52['as'],'attributes':_0x306b52['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ecd1c){logger[_0x2a17('0x14')](_0x2a17('0x15'),_0x5efd08);logger['debug']('GetSquareProjects',_0x5efd08,JSON[_0x2a17('0x16')](_0x5ecd1c));_0xb71902(_0x5ecd1c);})[_0x2a17('0x17')](function(_0x21f9d8){logger['error'](_0x2a17('0x15'),_0x21f9d8[_0x2a17('0x18')],_0x5efd08);_0x1a3592(_0xeb2e60[_0x2a17('0x19')](0x1f4,_0x21f9d8['message']));});});};exports[_0x2a17('0x1a')]=function(_0x37d31b){var _0x428246=this;return new Promise(function(_0xb81a3a,_0x4f8793){return db[_0x2a17('0xa')][_0x2a17('0x1b')]({'raw':_0x37d31b[_0x2a17('0xc')]?_0x37d31b[_0x2a17('0xc')][_0x2a17('0xd')]===undefined?!![]:![]:!![],'where':_0x37d31b[_0x2a17('0xc')]?_0x37d31b[_0x2a17('0xc')][_0x2a17('0xe')]||null:null,'attributes':_0x37d31b[_0x2a17('0xc')]?_0x37d31b[_0x2a17('0xc')][_0x2a17('0x12')]||null:null,'include':_0x37d31b[_0x2a17('0xc')]?_0x37d31b[_0x2a17('0xc')]['include']?_[_0x2a17('0x13')](_0x37d31b[_0x2a17('0xc')][_0x2a17('0x10')],function(_0x1986a4){return{'model':db[_0x1986a4[_0x2a17('0x11')]],'as':_0x1986a4['as'],'attributes':_0x1986a4[_0x2a17('0x12')],'include':_0x1986a4[_0x2a17('0x10')]?_[_0x2a17('0x13')](_0x1986a4[_0x2a17('0x10')],function(_0x43388c){return{'model':db[_0x43388c[_0x2a17('0x11')]],'as':_0x43388c['as'],'attributes':_0x43388c['attributes'],'include':_0x43388c[_0x2a17('0x10')]?_['map'](_0x43388c[_0x2a17('0x10')],function(_0x53875c){return{'model':db[_0x53875c[_0x2a17('0x11')]],'as':_0x53875c['as'],'attributes':_0x53875c['attributes']};}):[]};}):[]};}):[]:[]})[_0x2a17('0x1c')](function(_0x6306a6){logger[_0x2a17('0x14')]('ShowSquareProject',_0x37d31b);logger['debug']('ShowSquareProject',_0x37d31b,JSON[_0x2a17('0x16')](_0x6306a6));_0xb81a3a(_0x6306a6);})[_0x2a17('0x17')](function(_0x444b13){logger[_0x2a17('0x19')](_0x2a17('0x1a'),_0x444b13[_0x2a17('0x18')],_0x37d31b);_0x4f8793(_0x428246[_0x2a17('0x19')](0x1f4,_0x444b13[_0x2a17('0x18')]));});});};