Built motion from commit 6a09e18b.|2.6.11
[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 _0x88ca=['map','setDataValue','channel','exports','define','teams','Chat','Fax','Mail','Openchannel','Voice','all','catch','./team.attributes','get','Queues','then'];(function(_0x4fd1bf,_0xcfdab2){var _0x1d980a=function(_0x4677f4){while(--_0x4677f4){_0x4fd1bf['push'](_0x4fd1bf['shift']());}};_0x1d980a(++_0xcfdab2);}(_0x88ca,0x194));var _0xa88c=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x88ca[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require('lodash');var attributes=require(_0xa88c('0x0'));function getQueuesByChannel(_0x449ace,_0x45fba6){var _0xcadfd8=_0xa88c('0x1')+_0x45fba6+_0xa88c('0x2');return _0x449ace[_0xcadfd8]()[_0xa88c('0x3')](function(_0xc114cc){return _[_0xa88c('0x4')](_0xc114cc,function(_0x46b464){_0x46b464[_0xa88c('0x5')](_0xa88c('0x6'),_0x45fba6);return _0x46b464;});})['catch'](function(_0x5f526c){throw _0x5f526c;});}module[_0xa88c('0x7')]=function(_0x394626){return _0x394626[_0xa88c('0x8')]('Team',attributes,{'tableName':_0xa88c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3f3b6a=this;var _0x50a8d4=[_0xa88c('0xa'),_0xa88c('0xb'),_0xa88c('0xc'),_0xa88c('0xd'),'Sms',_0xa88c('0xe'),'Whatsapp'];return Promise['resolve']()[_0xa88c('0x3')](function(){var _0x191b7e=_['map'](_0x50a8d4,function(_0xc21949){return getQueuesByChannel(_0x3f3b6a,_0xc21949);});return Promise[_0xa88c('0xf')](_0x191b7e);})[_0xa88c('0x10')](function(_0x29b46e){throw _0x29b46e;});}}});};