Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / team / team.model.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 _0x29f8=['channel','catch','exports','define','Team','Chat','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29f8,0x13c));var _0x829f=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x29f8[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0x829f('0x0'));var attributes=require(_0x829f('0x1'));function getQueuesByChannel(_0x44ccea,_0x38bd13){var _0x498f85=_0x829f('0x2')+_0x38bd13+_0x829f('0x3');return _0x44ccea[_0x498f85]()[_0x829f('0x4')](function(_0x4ef8f6){return _[_0x829f('0x5')](_0x4ef8f6,function(_0x407b2c){_0x407b2c[_0x829f('0x6')](_0x829f('0x7'),_0x38bd13);return _0x407b2c;});})[_0x829f('0x8')](function(_0x377b53){throw _0x377b53;});}module[_0x829f('0x9')]=function(_0x33cd1d){return _0x33cd1d[_0x829f('0xa')](_0x829f('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5df09d=this;var _0x4817b7=[_0x829f('0xc'),'Fax','Mail',_0x829f('0xd'),_0x829f('0xe'),_0x829f('0xf'),_0x829f('0x10')];return Promise[_0x829f('0x11')]()[_0x829f('0x4')](function(){var _0x317c66=_[_0x829f('0x5')](_0x4817b7,function(_0x62ea95){return getQueuesByChannel(_0x5df09d,_0x62ea95);});return Promise[_0x829f('0x12')](_0x317c66);})[_0x829f('0x8')](function(_0x51d43c){throw _0x51d43c;});}}});};