Built motion from commit 64a6f4bc.|2.6.26
[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 _0x1bc9=['stringify','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','attributes','limit','include','model','map','then','debug','catch','error','message','ShowSquareProject','find','where','info'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x1bc9,0x1c3));var _0x91bc=function(_0x3843f6,_0x184013){_0x3843f6=_0x3843f6-0x0;var _0x1591b9=_0x1bc9[_0x3843f6];return _0x1591b9;};'use strict';var _=require(_0x91bc('0x0'));var Redis=require('ioredis');var db=require(_0x91bc('0x1'))['db'];var logger=require(_0x91bc('0x2'))(_0x91bc('0x3'));var config=require(_0x91bc('0x4'));config[_0x91bc('0x5')]=_[_0x91bc('0x6')](config[_0x91bc('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x91bc('0x7'))(new Redis(config['redis']));require(_0x91bc('0x8'))[_0x91bc('0x9')](socket);exports[_0x91bc('0xa')]=function(_0x396d4a){var _0x3fdcbc=this;return new Promise(function(_0x4bd4f1,_0xf2861){return db[_0x91bc('0xb')][_0x91bc('0xc')]({'raw':_0x396d4a[_0x91bc('0xd')]?_0x396d4a[_0x91bc('0xd')][_0x91bc('0xe')]===undefined?!![]:![]:!![],'where':_0x396d4a[_0x91bc('0xd')]?_0x396d4a[_0x91bc('0xd')]['where']||null:null,'attributes':_0x396d4a[_0x91bc('0xd')]?_0x396d4a['options'][_0x91bc('0xf')]||null:null,'limit':_0x396d4a[_0x91bc('0xd')]?_0x396d4a[_0x91bc('0xd')][_0x91bc('0x10')]||null:null,'include':_0x396d4a['options']?_0x396d4a[_0x91bc('0xd')][_0x91bc('0x11')]?_['map'](_0x396d4a[_0x91bc('0xd')][_0x91bc('0x11')],function(_0x3ee7cd){return{'model':db[_0x3ee7cd[_0x91bc('0x12')]],'as':_0x3ee7cd['as'],'attributes':_0x3ee7cd[_0x91bc('0xf')],'include':_0x3ee7cd['include']?_[_0x91bc('0x13')](_0x3ee7cd[_0x91bc('0x11')],function(_0x5f396f){return{'model':db[_0x5f396f[_0x91bc('0x12')]],'as':_0x5f396f['as'],'attributes':_0x5f396f[_0x91bc('0xf')],'include':_0x5f396f[_0x91bc('0x11')]?_[_0x91bc('0x13')](_0x5f396f['include'],function(_0x1a7e6e){return{'model':db[_0x1a7e6e[_0x91bc('0x12')]],'as':_0x1a7e6e['as'],'attributes':_0x1a7e6e[_0x91bc('0xf')]};}):[]};}):[]};}):[]:[]})[_0x91bc('0x14')](function(_0x2dbec9){logger['info'](_0x91bc('0xa'),_0x396d4a);logger[_0x91bc('0x15')](_0x91bc('0xa'),_0x396d4a,JSON['stringify'](_0x2dbec9));_0x4bd4f1(_0x2dbec9);})[_0x91bc('0x16')](function(_0x95d2d5){logger[_0x91bc('0x17')]('GetSquareProjects',_0x95d2d5[_0x91bc('0x18')],_0x396d4a);_0xf2861(_0x3fdcbc[_0x91bc('0x17')](0x1f4,_0x95d2d5[_0x91bc('0x18')]));});});};exports[_0x91bc('0x19')]=function(_0x416c0e){var _0x1cbf11=this;return new Promise(function(_0x54566b,_0x319b0f){return db['SquareProject'][_0x91bc('0x1a')]({'raw':_0x416c0e[_0x91bc('0xd')]?_0x416c0e[_0x91bc('0xd')][_0x91bc('0xe')]===undefined?!![]:![]:!![],'where':_0x416c0e['options']?_0x416c0e[_0x91bc('0xd')][_0x91bc('0x1b')]||null:null,'attributes':_0x416c0e[_0x91bc('0xd')]?_0x416c0e['options'][_0x91bc('0xf')]||null:null,'include':_0x416c0e[_0x91bc('0xd')]?_0x416c0e[_0x91bc('0xd')][_0x91bc('0x11')]?_[_0x91bc('0x13')](_0x416c0e[_0x91bc('0xd')][_0x91bc('0x11')],function(_0x3ce219){return{'model':db[_0x3ce219[_0x91bc('0x12')]],'as':_0x3ce219['as'],'attributes':_0x3ce219['attributes'],'include':_0x3ce219['include']?_[_0x91bc('0x13')](_0x3ce219[_0x91bc('0x11')],function(_0x4ef546){return{'model':db[_0x4ef546['model']],'as':_0x4ef546['as'],'attributes':_0x4ef546[_0x91bc('0xf')],'include':_0x4ef546[_0x91bc('0x11')]?_[_0x91bc('0x13')](_0x4ef546[_0x91bc('0x11')],function(_0x3bd93e){return{'model':db[_0x3bd93e[_0x91bc('0x12')]],'as':_0x3bd93e['as'],'attributes':_0x3bd93e['attributes']};}):[]};}):[]};}):[]:[]})[_0x91bc('0x14')](function(_0x47fd04){logger[_0x91bc('0x1c')](_0x91bc('0x19'),_0x416c0e);logger['debug'](_0x91bc('0x19'),_0x416c0e,JSON[_0x91bc('0x1d')](_0x47fd04));_0x54566b(_0x47fd04);})[_0x91bc('0x16')](function(_0x1c1e79){logger[_0x91bc('0x17')](_0x91bc('0x19'),_0x1c1e79[_0x91bc('0x18')],_0x416c0e);_0x319b0f(_0x1cbf11[_0x91bc('0x17')](0x1f4,_0x1c1e79['message']));});});};