Built motion from commit b0a9a629.|2.6.33
[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 _0xb1f5=['./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','ShowSquareProject','find','message','lodash','ioredis','rpc','../../config/environment','redis','localhost','socket.io-emitter'];(function(_0xce44ee,_0x387d70){var _0xf97a49=function(_0x3ceab0){while(--_0x3ceab0){_0xce44ee['push'](_0xce44ee['shift']());}};_0xf97a49(++_0x387d70);}(_0xb1f5,0x1f1));var _0x5b1f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb1f5[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5b1f('0x0'));var Redis=require(_0x5b1f('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x5b1f('0x2'));var config=require(_0x5b1f('0x3'));config[_0x5b1f('0x4')]=_['defaults'](config[_0x5b1f('0x4')],{'host':_0x5b1f('0x5'),'port':0x18eb});var socket=require(_0x5b1f('0x6'))(new Redis(config['redis']));require(_0x5b1f('0x7'))[_0x5b1f('0x8')](socket);exports[_0x5b1f('0x9')]=function(_0x5a76ae){var _0x4d7599=this;return new Promise(function(_0x2b1736,_0x497a38){return db[_0x5b1f('0xa')]['findAll']({'raw':_0x5a76ae['options']?_0x5a76ae[_0x5b1f('0xb')][_0x5b1f('0xc')]===undefined?!![]:![]:!![],'where':_0x5a76ae[_0x5b1f('0xb')]?_0x5a76ae['options'][_0x5b1f('0xd')]||null:null,'attributes':_0x5a76ae[_0x5b1f('0xb')]?_0x5a76ae[_0x5b1f('0xb')][_0x5b1f('0xe')]||null:null,'limit':_0x5a76ae['options']?_0x5a76ae[_0x5b1f('0xb')][_0x5b1f('0xf')]||null:null,'include':_0x5a76ae['options']?_0x5a76ae['options']['include']?_['map'](_0x5a76ae[_0x5b1f('0xb')][_0x5b1f('0x10')],function(_0x2bae04){return{'model':db[_0x2bae04[_0x5b1f('0x11')]],'as':_0x2bae04['as'],'attributes':_0x2bae04[_0x5b1f('0xe')],'include':_0x2bae04['include']?_[_0x5b1f('0x12')](_0x2bae04[_0x5b1f('0x10')],function(_0x5a9d3c){return{'model':db[_0x5a9d3c[_0x5b1f('0x11')]],'as':_0x5a9d3c['as'],'attributes':_0x5a9d3c['attributes'],'include':_0x5a9d3c[_0x5b1f('0x10')]?_[_0x5b1f('0x12')](_0x5a9d3c[_0x5b1f('0x10')],function(_0x38f46e){return{'model':db[_0x38f46e[_0x5b1f('0x11')]],'as':_0x38f46e['as'],'attributes':_0x38f46e[_0x5b1f('0xe')]};}):[]};}):[]};}):[]:[]})[_0x5b1f('0x13')](function(_0x31f2d6){logger[_0x5b1f('0x14')](_0x5b1f('0x9'),_0x5a76ae);logger[_0x5b1f('0x15')](_0x5b1f('0x9'),_0x5a76ae,JSON[_0x5b1f('0x16')](_0x31f2d6));_0x2b1736(_0x31f2d6);})[_0x5b1f('0x17')](function(_0xfe123b){logger[_0x5b1f('0x18')](_0x5b1f('0x9'),_0xfe123b['message'],_0x5a76ae);_0x497a38(_0x4d7599[_0x5b1f('0x18')](0x1f4,_0xfe123b['message']));});});};exports[_0x5b1f('0x19')]=function(_0x2cbda8){var _0xb5129d=this;return new Promise(function(_0x2bd6d5,_0x25b15c){return db[_0x5b1f('0xa')][_0x5b1f('0x1a')]({'raw':_0x2cbda8[_0x5b1f('0xb')]?_0x2cbda8[_0x5b1f('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x2cbda8[_0x5b1f('0xb')]?_0x2cbda8[_0x5b1f('0xb')][_0x5b1f('0xd')]||null:null,'attributes':_0x2cbda8[_0x5b1f('0xb')]?_0x2cbda8[_0x5b1f('0xb')][_0x5b1f('0xe')]||null:null,'include':_0x2cbda8[_0x5b1f('0xb')]?_0x2cbda8[_0x5b1f('0xb')][_0x5b1f('0x10')]?_['map'](_0x2cbda8[_0x5b1f('0xb')][_0x5b1f('0x10')],function(_0x21de08){return{'model':db[_0x21de08[_0x5b1f('0x11')]],'as':_0x21de08['as'],'attributes':_0x21de08['attributes'],'include':_0x21de08['include']?_[_0x5b1f('0x12')](_0x21de08[_0x5b1f('0x10')],function(_0x2f9119){return{'model':db[_0x2f9119['model']],'as':_0x2f9119['as'],'attributes':_0x2f9119[_0x5b1f('0xe')],'include':_0x2f9119[_0x5b1f('0x10')]?_[_0x5b1f('0x12')](_0x2f9119[_0x5b1f('0x10')],function(_0x138f4b){return{'model':db[_0x138f4b[_0x5b1f('0x11')]],'as':_0x138f4b['as'],'attributes':_0x138f4b[_0x5b1f('0xe')]};}):[]};}):[]};}):[]:[]})[_0x5b1f('0x13')](function(_0x5f3692){logger[_0x5b1f('0x14')](_0x5b1f('0x19'),_0x2cbda8);logger[_0x5b1f('0x15')](_0x5b1f('0x19'),_0x2cbda8,JSON[_0x5b1f('0x16')](_0x5f3692));_0x2bd6d5(_0x5f3692);})[_0x5b1f('0x17')](function(_0x48dfcc){logger[_0x5b1f('0x18')](_0x5b1f('0x19'),_0x48dfcc[_0x5b1f('0x1b')],_0x2cbda8);_0x25b15c(_0xb5129d[_0x5b1f('0x18')](0x1f4,_0x48dfcc[_0x5b1f('0x1b')]));});});};