Built motion from commit cafec4f3.|2.6.31
[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 _0x4513=['debug','stringify','catch','error','message','ShowSquareProject','where','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','attributes','limit','map','include','model','then','info'];(function(_0x49967e,_0x2a4d8c){var _0x3cfd83=function(_0x13bfba){while(--_0x13bfba){_0x49967e['push'](_0x49967e['shift']());}};_0x3cfd83(++_0x2a4d8c);}(_0x4513,0x1ba));var _0x3451=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4513[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x3451('0x0'));var Redis=require(_0x3451('0x1'));var db=require(_0x3451('0x2'))['db'];var logger=require(_0x3451('0x3'))(_0x3451('0x4'));var config=require(_0x3451('0x5'));config[_0x3451('0x6')]=_[_0x3451('0x7')](config[_0x3451('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x3451('0x8'))(new Redis(config['redis']));require('./squareProject.socket')[_0x3451('0x9')](socket);exports[_0x3451('0xa')]=function(_0x582a58){var _0x4e93fc=this;return new Promise(function(_0x165bb4,_0x5e8f50){return db[_0x3451('0xb')][_0x3451('0xc')]({'raw':_0x582a58['options']?_0x582a58[_0x3451('0xd')][_0x3451('0xe')]===undefined?!![]:![]:!![],'where':_0x582a58['options']?_0x582a58[_0x3451('0xd')]['where']||null:null,'attributes':_0x582a58[_0x3451('0xd')]?_0x582a58[_0x3451('0xd')][_0x3451('0xf')]||null:null,'limit':_0x582a58[_0x3451('0xd')]?_0x582a58[_0x3451('0xd')][_0x3451('0x10')]||null:null,'include':_0x582a58[_0x3451('0xd')]?_0x582a58[_0x3451('0xd')]['include']?_[_0x3451('0x11')](_0x582a58[_0x3451('0xd')][_0x3451('0x12')],function(_0x18a00d){return{'model':db[_0x18a00d['model']],'as':_0x18a00d['as'],'attributes':_0x18a00d[_0x3451('0xf')],'include':_0x18a00d[_0x3451('0x12')]?_[_0x3451('0x11')](_0x18a00d[_0x3451('0x12')],function(_0x1c504c){return{'model':db[_0x1c504c[_0x3451('0x13')]],'as':_0x1c504c['as'],'attributes':_0x1c504c[_0x3451('0xf')],'include':_0x1c504c[_0x3451('0x12')]?_[_0x3451('0x11')](_0x1c504c[_0x3451('0x12')],function(_0x70718d){return{'model':db[_0x70718d[_0x3451('0x13')]],'as':_0x70718d['as'],'attributes':_0x70718d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3451('0x14')](function(_0x30d35f){logger[_0x3451('0x15')](_0x3451('0xa'),_0x582a58);logger[_0x3451('0x16')]('GetSquareProjects',_0x582a58,JSON[_0x3451('0x17')](_0x30d35f));_0x165bb4(_0x30d35f);})[_0x3451('0x18')](function(_0x50626a){logger[_0x3451('0x19')]('GetSquareProjects',_0x50626a['message'],_0x582a58);_0x5e8f50(_0x4e93fc[_0x3451('0x19')](0x1f4,_0x50626a[_0x3451('0x1a')]));});});};exports[_0x3451('0x1b')]=function(_0x36723a){var _0x2665b0=this;return new Promise(function(_0x18fc47,_0x5512ab){return db[_0x3451('0xb')]['find']({'raw':_0x36723a['options']?_0x36723a['options'][_0x3451('0xe')]===undefined?!![]:![]:!![],'where':_0x36723a[_0x3451('0xd')]?_0x36723a['options'][_0x3451('0x1c')]||null:null,'attributes':_0x36723a[_0x3451('0xd')]?_0x36723a['options']['attributes']||null:null,'include':_0x36723a[_0x3451('0xd')]?_0x36723a[_0x3451('0xd')]['include']?_[_0x3451('0x11')](_0x36723a['options']['include'],function(_0xdadd4f){return{'model':db[_0xdadd4f['model']],'as':_0xdadd4f['as'],'attributes':_0xdadd4f[_0x3451('0xf')],'include':_0xdadd4f['include']?_[_0x3451('0x11')](_0xdadd4f[_0x3451('0x12')],function(_0x32a612){return{'model':db[_0x32a612[_0x3451('0x13')]],'as':_0x32a612['as'],'attributes':_0x32a612[_0x3451('0xf')],'include':_0x32a612[_0x3451('0x12')]?_[_0x3451('0x11')](_0x32a612['include'],function(_0x182417){return{'model':db[_0x182417[_0x3451('0x13')]],'as':_0x182417['as'],'attributes':_0x182417[_0x3451('0xf')]};}):[]};}):[]};}):[]:[]})[_0x3451('0x14')](function(_0x20ee65){logger[_0x3451('0x15')](_0x3451('0x1b'),_0x36723a);logger[_0x3451('0x16')](_0x3451('0x1b'),_0x36723a,JSON[_0x3451('0x17')](_0x20ee65));_0x18fc47(_0x20ee65);})[_0x3451('0x18')](function(_0x55dd33){logger[_0x3451('0x19')](_0x3451('0x1b'),_0x55dd33['message'],_0x36723a);_0x5512ab(_0x2665b0[_0x3451('0x19')](0x1f4,_0x55dd33[_0x3451('0x1a')]));});});};