Built motion from commit 47436d59.|2.6.7
[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 _0x7cd0=['Team','teams','Mail','Openchannel','Sms','Voice','Whatsapp','map','lodash','./team.attributes','get','Queues','then','channel','catch','define'];(function(_0x19c315,_0x2b2e84){var _0x3dc378=function(_0x258022){while(--_0x258022){_0x19c315['push'](_0x19c315['shift']());}};_0x3dc378(++_0x2b2e84);}(_0x7cd0,0x1e8));var _0x07cd=function(_0x203c05,_0x584521){_0x203c05=_0x203c05-0x0;var _0x43a504=_0x7cd0[_0x203c05];return _0x43a504;};'use strict';var _=require(_0x07cd('0x0'));var attributes=require(_0x07cd('0x1'));function getQueuesByChannel(_0x5c6676,_0x840d7f){var _0x248277=_0x07cd('0x2')+_0x840d7f+_0x07cd('0x3');return _0x5c6676[_0x248277]()[_0x07cd('0x4')](function(_0x10bd35){return _['map'](_0x10bd35,function(_0x19bbcb){_0x19bbcb['setDataValue'](_0x07cd('0x5'),_0x840d7f);return _0x19bbcb;});})[_0x07cd('0x6')](function(_0x4d6690){throw _0x4d6690;});}module['exports']=function(_0xb28b0){return _0xb28b0[_0x07cd('0x7')](_0x07cd('0x8'),attributes,{'tableName':_0x07cd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x149e7b=this;var _0x18c9f0=['Chat','Fax',_0x07cd('0xa'),_0x07cd('0xb'),_0x07cd('0xc'),_0x07cd('0xd'),_0x07cd('0xe')];return Promise['resolve']()['then'](function(){var _0x1f74af=_[_0x07cd('0xf')](_0x18c9f0,function(_0xa58f1e){return getQueuesByChannel(_0x149e7b,_0xa58f1e);});return Promise['all'](_0x1f74af);})[_0x07cd('0x6')](function(_0x29a062){throw _0x29a062;});}}});};