1f6e1afcb8616eda5edac955abda5c903e0bb527
[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 _0x0c5d=['then','lodash','./team.attributes','get','Queues','map','setDataValue','catch','exports','define','Team','Chat','Fax','Openchannel','Voice','Whatsapp','resolve'];(function(_0x3e8cb5,_0x3b1631){var _0x23b492=function(_0x3db0e5){while(--_0x3db0e5){_0x3e8cb5['push'](_0x3e8cb5['shift']());}};_0x23b492(++_0x3b1631);}(_0x0c5d,0xbc));var _0xd0c5=function(_0x32b322,_0x273b21){_0x32b322=_0x32b322-0x0;var _0x83b3c7=_0x0c5d[_0x32b322];return _0x83b3c7;};'use strict';var _=require(_0xd0c5('0x0'));var attributes=require(_0xd0c5('0x1'));function getQueuesByChannel(_0x4bbde7,_0x268fde){var _0x18c89f=_0xd0c5('0x2')+_0x268fde+_0xd0c5('0x3');return _0x4bbde7[_0x18c89f]()['then'](function(_0x43b992){return _[_0xd0c5('0x4')](_0x43b992,function(_0x18e1fc){_0x18e1fc[_0xd0c5('0x5')]('channel',_0x268fde);return _0x18e1fc;});})[_0xd0c5('0x6')](function(_0x35a75e){throw _0x35a75e;});}module[_0xd0c5('0x7')]=function(_0x51305e){return _0x51305e[_0xd0c5('0x8')](_0xd0c5('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x58bf2b=this;var _0x5dd95a=[_0xd0c5('0xa'),_0xd0c5('0xb'),'Mail',_0xd0c5('0xc'),'Sms',_0xd0c5('0xd'),_0xd0c5('0xe')];return Promise[_0xd0c5('0xf')]()[_0xd0c5('0x10')](function(){var _0x3b126c=_[_0xd0c5('0x4')](_0x5dd95a,function(_0x36b982){return getQueuesByChannel(_0x58bf2b,_0x36b982);});return Promise['all'](_0x3b126c);})['catch'](function(_0x21e49c){throw _0x21e49c;});}}});};