Built motion from commit 2e4747fd.|2.6.7
[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 _0xccf2=['model','then','info','debug','catch','error','message','ShowSquareProject','find','stringify','../../mysqldb','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map'];(function(_0xa4c26f,_0x398ae2){var _0x433772=function(_0x5a7ae7){while(--_0x5a7ae7){_0xa4c26f['push'](_0xa4c26f['shift']());}};_0x433772(++_0x398ae2);}(_0xccf2,0x1ae));var _0x2ccf=function(_0x2bfdde,_0x400692){_0x2bfdde=_0x2bfdde-0x0;var _0x38c564=_0xccf2[_0x2bfdde];return _0x38c564;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x2ccf('0x0'))['db'];var logger=require('../../config/logger')(_0x2ccf('0x1'));var config=require(_0x2ccf('0x2'));config[_0x2ccf('0x3')]=_[_0x2ccf('0x4')](config[_0x2ccf('0x3')],{'host':_0x2ccf('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ccf('0x3')]));require(_0x2ccf('0x6'))[_0x2ccf('0x7')](socket);exports[_0x2ccf('0x8')]=function(_0x13273e){var _0x5df0ce=this;return new Promise(function(_0x530d4b,_0x42482f){return db[_0x2ccf('0x9')][_0x2ccf('0xa')]({'raw':_0x13273e[_0x2ccf('0xb')]?_0x13273e[_0x2ccf('0xb')][_0x2ccf('0xc')]===undefined?!![]:![]:!![],'where':_0x13273e['options']?_0x13273e[_0x2ccf('0xb')][_0x2ccf('0xd')]||null:null,'attributes':_0x13273e[_0x2ccf('0xb')]?_0x13273e['options'][_0x2ccf('0xe')]||null:null,'limit':_0x13273e[_0x2ccf('0xb')]?_0x13273e[_0x2ccf('0xb')][_0x2ccf('0xf')]||null:null,'include':_0x13273e['options']?_0x13273e[_0x2ccf('0xb')][_0x2ccf('0x10')]?_[_0x2ccf('0x11')](_0x13273e[_0x2ccf('0xb')][_0x2ccf('0x10')],function(_0x21f2d8){return{'model':db[_0x21f2d8[_0x2ccf('0x12')]],'as':_0x21f2d8['as'],'attributes':_0x21f2d8[_0x2ccf('0xe')],'include':_0x21f2d8[_0x2ccf('0x10')]?_[_0x2ccf('0x11')](_0x21f2d8[_0x2ccf('0x10')],function(_0xea2cf1){return{'model':db[_0xea2cf1[_0x2ccf('0x12')]],'as':_0xea2cf1['as'],'attributes':_0xea2cf1[_0x2ccf('0xe')],'include':_0xea2cf1[_0x2ccf('0x10')]?_[_0x2ccf('0x11')](_0xea2cf1['include'],function(_0x28ea0d){return{'model':db[_0x28ea0d[_0x2ccf('0x12')]],'as':_0x28ea0d['as'],'attributes':_0x28ea0d[_0x2ccf('0xe')]};}):[]};}):[]};}):[]:[]})[_0x2ccf('0x13')](function(_0x157a1b){logger[_0x2ccf('0x14')](_0x2ccf('0x8'),_0x13273e);logger[_0x2ccf('0x15')](_0x2ccf('0x8'),_0x13273e,JSON['stringify'](_0x157a1b));_0x530d4b(_0x157a1b);})[_0x2ccf('0x16')](function(_0x169af0){logger[_0x2ccf('0x17')](_0x2ccf('0x8'),_0x169af0[_0x2ccf('0x18')],_0x13273e);_0x42482f(_0x5df0ce[_0x2ccf('0x17')](0x1f4,_0x169af0[_0x2ccf('0x18')]));});});};exports[_0x2ccf('0x19')]=function(_0x27fc06){var _0x2a5eea=this;return new Promise(function(_0x3b42dc,_0x5c1420){return db[_0x2ccf('0x9')][_0x2ccf('0x1a')]({'raw':_0x27fc06[_0x2ccf('0xb')]?_0x27fc06[_0x2ccf('0xb')][_0x2ccf('0xc')]===undefined?!![]:![]:!![],'where':_0x27fc06[_0x2ccf('0xb')]?_0x27fc06['options'][_0x2ccf('0xd')]||null:null,'attributes':_0x27fc06['options']?_0x27fc06[_0x2ccf('0xb')]['attributes']||null:null,'include':_0x27fc06[_0x2ccf('0xb')]?_0x27fc06[_0x2ccf('0xb')][_0x2ccf('0x10')]?_[_0x2ccf('0x11')](_0x27fc06[_0x2ccf('0xb')]['include'],function(_0x19c0de){return{'model':db[_0x19c0de[_0x2ccf('0x12')]],'as':_0x19c0de['as'],'attributes':_0x19c0de[_0x2ccf('0xe')],'include':_0x19c0de[_0x2ccf('0x10')]?_[_0x2ccf('0x11')](_0x19c0de['include'],function(_0x46638d){return{'model':db[_0x46638d['model']],'as':_0x46638d['as'],'attributes':_0x46638d[_0x2ccf('0xe')],'include':_0x46638d[_0x2ccf('0x10')]?_[_0x2ccf('0x11')](_0x46638d[_0x2ccf('0x10')],function(_0x1f5ba3){return{'model':db[_0x1f5ba3[_0x2ccf('0x12')]],'as':_0x1f5ba3['as'],'attributes':_0x1f5ba3[_0x2ccf('0xe')]};}):[]};}):[]};}):[]:[]})[_0x2ccf('0x13')](function(_0x100158){logger[_0x2ccf('0x14')](_0x2ccf('0x19'),_0x27fc06);logger[_0x2ccf('0x15')](_0x2ccf('0x19'),_0x27fc06,JSON[_0x2ccf('0x1b')](_0x100158));_0x3b42dc(_0x100158);})[_0x2ccf('0x16')](function(_0x47c2b2){logger[_0x2ccf('0x17')]('ShowSquareProject',_0x47c2b2[_0x2ccf('0x18')],_0x27fc06);_0x5c1420(_0x2a5eea['error'](0x1f4,_0x47c2b2['message']));});});};