Built motion from commit b5996064.|2.6.21
[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 _0x2d1b=['teams','Fax','Mail','Openchannel','Whatsapp','resolve','all','lodash','./team.attributes','get','then','map','setDataValue','channel','catch'];(function(_0x4ca3f1,_0x4af7c1){var _0x1350b7=function(_0x346e91){while(--_0x346e91){_0x4ca3f1['push'](_0x4ca3f1['shift']());}};_0x1350b7(++_0x4af7c1);}(_0x2d1b,0x7f));var _0xb2d1=function(_0x305e15,_0x4a983d){_0x305e15=_0x305e15-0x0;var _0xb68bc6=_0x2d1b[_0x305e15];return _0xb68bc6;};'use strict';var _=require(_0xb2d1('0x0'));var attributes=require(_0xb2d1('0x1'));function getQueuesByChannel(_0x212d33,_0x2d66cd){var _0x38de1b=_0xb2d1('0x2')+_0x2d66cd+'Queues';return _0x212d33[_0x38de1b]()[_0xb2d1('0x3')](function(_0x7029d5){return _[_0xb2d1('0x4')](_0x7029d5,function(_0x1c17c1){_0x1c17c1[_0xb2d1('0x5')](_0xb2d1('0x6'),_0x2d66cd);return _0x1c17c1;});})[_0xb2d1('0x7')](function(_0x4cbf80){throw _0x4cbf80;});}module['exports']=function(_0x19ddb5){return _0x19ddb5['define']('Team',attributes,{'tableName':_0xb2d1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x7c999b=this;var _0x201039=['Chat',_0xb2d1('0x9'),_0xb2d1('0xa'),_0xb2d1('0xb'),'Sms','Voice',_0xb2d1('0xc')];return Promise[_0xb2d1('0xd')]()[_0xb2d1('0x3')](function(){var _0x22f6ac=_[_0xb2d1('0x4')](_0x201039,function(_0x3c8160){return getQueuesByChannel(_0x7c999b,_0x3c8160);});return Promise[_0xb2d1('0xe')](_0x22f6ac);})[_0xb2d1('0x7')](function(_0x487c54){throw _0x487c54;});}}});};