9b7f15f1d72952bcfd79c82ec932d53ee9b9834f
[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 _0x95a9=['Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','catch','lodash','./team.attributes','Queues','then','map','setDataValue','channel','exports','define','Team'];(function(_0x127541,_0xda3c88){var _0x4cce21=function(_0x39b5d4){while(--_0x39b5d4){_0x127541['push'](_0x127541['shift']());}};_0x4cce21(++_0xda3c88);}(_0x95a9,0x172));var _0x995a=function(_0x1a8626,_0x14f403){_0x1a8626=_0x1a8626-0x0;var _0x153526=_0x95a9[_0x1a8626];return _0x153526;};'use strict';var _=require(_0x995a('0x0'));var attributes=require(_0x995a('0x1'));function getQueuesByChannel(_0x4161f8,_0x19eabb){var _0x2f52f4='get'+_0x19eabb+_0x995a('0x2');return _0x4161f8[_0x2f52f4]()[_0x995a('0x3')](function(_0x15ff79){return _[_0x995a('0x4')](_0x15ff79,function(_0x3b6ec3){_0x3b6ec3[_0x995a('0x5')](_0x995a('0x6'),_0x19eabb);return _0x3b6ec3;});})['catch'](function(_0x571005){throw _0x571005;});}module[_0x995a('0x7')]=function(_0x586b41){return _0x586b41[_0x995a('0x8')](_0x995a('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x18d907=this;var _0x3f41f1=[_0x995a('0xa'),_0x995a('0xb'),_0x995a('0xc'),_0x995a('0xd'),_0x995a('0xe'),_0x995a('0xf'),_0x995a('0x10')];return Promise[_0x995a('0x11')]()['then'](function(){var _0x4ead5a=_['map'](_0x3f41f1,function(_0x40f363){return getQueuesByChannel(_0x18d907,_0x40f363);});return Promise[_0x995a('0x12')](_0x4ead5a);})[_0x995a('0x13')](function(_0x527678){throw _0x527678;});}}});};