Built motion from commit 953226e6.|2.6.32
[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 _0x6de3=['then','debug','stringify','lodash','ioredis','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','SquareProject','findAll','options','raw','where','limit','map','include','model','attributes','info','GetSquareProjects','catch','error','message','ShowSquareProject','find'];(function(_0x345a6d,_0x137f9a){var _0x2b4df7=function(_0x20ba5c){while(--_0x20ba5c){_0x345a6d['push'](_0x345a6d['shift']());}};_0x2b4df7(++_0x137f9a);}(_0x6de3,0x16b));var _0x36de=function(_0x376a23,_0x4b8386){_0x376a23=_0x376a23-0x0;var _0x9fa71a=_0x6de3[_0x376a23];return _0x9fa71a;};'use strict';var _=require(_0x36de('0x0'));var Redis=require(_0x36de('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x36de('0x2'))(_0x36de('0x3'));var config=require(_0x36de('0x4'));config['redis']=_[_0x36de('0x5')](config[_0x36de('0x6')],{'host':_0x36de('0x7'),'port':0x18eb});var socket=require(_0x36de('0x8'))(new Redis(config['redis']));require('./squareProject.socket')[_0x36de('0x9')](socket);exports['GetSquareProjects']=function(_0x34cf79){var _0x3aaeea=this;return new Promise(function(_0x211def,_0x472362){return db[_0x36de('0xa')][_0x36de('0xb')]({'raw':_0x34cf79[_0x36de('0xc')]?_0x34cf79['options'][_0x36de('0xd')]===undefined?!![]:![]:!![],'where':_0x34cf79['options']?_0x34cf79['options'][_0x36de('0xe')]||null:null,'attributes':_0x34cf79['options']?_0x34cf79[_0x36de('0xc')]['attributes']||null:null,'limit':_0x34cf79['options']?_0x34cf79['options'][_0x36de('0xf')]||null:null,'include':_0x34cf79[_0x36de('0xc')]?_0x34cf79[_0x36de('0xc')]['include']?_[_0x36de('0x10')](_0x34cf79[_0x36de('0xc')][_0x36de('0x11')],function(_0x19a059){return{'model':db[_0x19a059[_0x36de('0x12')]],'as':_0x19a059['as'],'attributes':_0x19a059[_0x36de('0x13')],'include':_0x19a059['include']?_['map'](_0x19a059['include'],function(_0x203c4a){return{'model':db[_0x203c4a['model']],'as':_0x203c4a['as'],'attributes':_0x203c4a[_0x36de('0x13')],'include':_0x203c4a[_0x36de('0x11')]?_['map'](_0x203c4a['include'],function(_0x3e70c1){return{'model':db[_0x3e70c1[_0x36de('0x12')]],'as':_0x3e70c1['as'],'attributes':_0x3e70c1[_0x36de('0x13')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e437d){logger[_0x36de('0x14')](_0x36de('0x15'),_0x34cf79);logger['debug'](_0x36de('0x15'),_0x34cf79,JSON['stringify'](_0x4e437d));_0x211def(_0x4e437d);})[_0x36de('0x16')](function(_0x3cef9d){logger[_0x36de('0x17')](_0x36de('0x15'),_0x3cef9d[_0x36de('0x18')],_0x34cf79);_0x472362(_0x3aaeea[_0x36de('0x17')](0x1f4,_0x3cef9d['message']));});});};exports[_0x36de('0x19')]=function(_0x277a67){var _0x2b733f=this;return new Promise(function(_0x1dd3bd,_0x5cead3){return db[_0x36de('0xa')][_0x36de('0x1a')]({'raw':_0x277a67[_0x36de('0xc')]?_0x277a67[_0x36de('0xc')][_0x36de('0xd')]===undefined?!![]:![]:!![],'where':_0x277a67['options']?_0x277a67['options'][_0x36de('0xe')]||null:null,'attributes':_0x277a67[_0x36de('0xc')]?_0x277a67[_0x36de('0xc')][_0x36de('0x13')]||null:null,'include':_0x277a67[_0x36de('0xc')]?_0x277a67[_0x36de('0xc')][_0x36de('0x11')]?_[_0x36de('0x10')](_0x277a67[_0x36de('0xc')][_0x36de('0x11')],function(_0x4c7362){return{'model':db[_0x4c7362[_0x36de('0x12')]],'as':_0x4c7362['as'],'attributes':_0x4c7362[_0x36de('0x13')],'include':_0x4c7362[_0x36de('0x11')]?_[_0x36de('0x10')](_0x4c7362[_0x36de('0x11')],function(_0x18f3a3){return{'model':db[_0x18f3a3['model']],'as':_0x18f3a3['as'],'attributes':_0x18f3a3['attributes'],'include':_0x18f3a3[_0x36de('0x11')]?_[_0x36de('0x10')](_0x18f3a3['include'],function(_0x27aa89){return{'model':db[_0x27aa89[_0x36de('0x12')]],'as':_0x27aa89['as'],'attributes':_0x27aa89[_0x36de('0x13')]};}):[]};}):[]};}):[]:[]})[_0x36de('0x1b')](function(_0x41fb65){logger[_0x36de('0x14')](_0x36de('0x19'),_0x277a67);logger[_0x36de('0x1c')](_0x36de('0x19'),_0x277a67,JSON[_0x36de('0x1d')](_0x41fb65));_0x1dd3bd(_0x41fb65);})[_0x36de('0x16')](function(_0x5445f0){logger['error'](_0x36de('0x19'),_0x5445f0[_0x36de('0x18')],_0x277a67);_0x5cead3(_0x2b733f[_0x36de('0x17')](0x1f4,_0x5445f0[_0x36de('0x18')]));});});};