138a94ec5f089e070fd152f0fcc2bc6b9d13aae2
[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 _0x9ff7=['define','Team','Mail','Openchannel','resolve','all','lodash','./team.attributes','get','Queues','then','map','channel','catch','exports'];(function(_0xe95cae,_0x21dd59){var _0x25beb0=function(_0x23b8b0){while(--_0x23b8b0){_0xe95cae['push'](_0xe95cae['shift']());}};_0x25beb0(++_0x21dd59);}(_0x9ff7,0x7e));var _0x79ff=function(_0x18bf86,_0xa8e65e){_0x18bf86=_0x18bf86-0x0;var _0x66a378=_0x9ff7[_0x18bf86];return _0x66a378;};'use strict';var _=require(_0x79ff('0x0'));var attributes=require(_0x79ff('0x1'));function getQueuesByChannel(_0xd0b999,_0x46034a){var _0x2f05a7=_0x79ff('0x2')+_0x46034a+_0x79ff('0x3');return _0xd0b999[_0x2f05a7]()[_0x79ff('0x4')](function(_0x187dfe){return _[_0x79ff('0x5')](_0x187dfe,function(_0x5cb703){_0x5cb703['setDataValue'](_0x79ff('0x6'),_0x46034a);return _0x5cb703;});})[_0x79ff('0x7')](function(_0x2f198a){throw _0x2f198a;});}module[_0x79ff('0x8')]=function(_0x4f9c6b){return _0x4f9c6b[_0x79ff('0x9')](_0x79ff('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x2106aa=this;var _0x2da7ba=['Chat','Fax',_0x79ff('0xb'),_0x79ff('0xc'),'Sms','Voice','Whatsapp'];return Promise[_0x79ff('0xd')]()['then'](function(){var _0x56af8a=_[_0x79ff('0x5')](_0x2da7ba,function(_0x39c2b0){return getQueuesByChannel(_0x2106aa,_0x39c2b0);});return Promise[_0x79ff('0xe')](_0x56af8a);})[_0x79ff('0x7')](function(_0x38da32){throw _0x38da32;});}}});};