Built motion from commit 449495f6.|2.6.27
[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 _0x9090=['resolve','map','lodash','get','Queues','then','setDataValue','channel','catch','define','Chat','Fax','Mail','Voice','Whatsapp'];(function(_0x3eab55,_0x4d0bad){var _0x18be83=function(_0xcf90db){while(--_0xcf90db){_0x3eab55['push'](_0x3eab55['shift']());}};_0x18be83(++_0x4d0bad);}(_0x9090,0x13d));var _0x0909=function(_0xa53124,_0x5a03d7){_0xa53124=_0xa53124-0x0;var _0x557456=_0x9090[_0xa53124];return _0x557456;};'use strict';var _=require(_0x0909('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x52861d,_0x342385){var _0x42d3a5=_0x0909('0x1')+_0x342385+_0x0909('0x2');return _0x52861d[_0x42d3a5]()[_0x0909('0x3')](function(_0x417397){return _['map'](_0x417397,function(_0x242abc){_0x242abc[_0x0909('0x4')](_0x0909('0x5'),_0x342385);return _0x242abc;});})[_0x0909('0x6')](function(_0x48bce4){throw _0x48bce4;});}module['exports']=function(_0x3b9f26){return _0x3b9f26[_0x0909('0x7')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xe9703a=this;var _0x353151=[_0x0909('0x8'),_0x0909('0x9'),_0x0909('0xa'),'Openchannel','Sms',_0x0909('0xb'),_0x0909('0xc')];return Promise[_0x0909('0xd')]()[_0x0909('0x3')](function(){var _0x43251d=_[_0x0909('0xe')](_0x353151,function(_0x3a47ed){return getQueuesByChannel(_0xe9703a,_0x3a47ed);});return Promise['all'](_0x43251d);})['catch'](function(_0x442d46){throw _0x442d46;});}}});};