Built motion from commit c738b9ac.|2.6.25
[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 _0xc788=['exports','define','Team','teams','Fax','Mail','Openchannel','Sms','Voice','resolve','map','all','lodash','./team.attributes','Queues','then','setDataValue','channel','catch'];(function(_0x4e8286,_0x4eaeb4){var _0x44a440=function(_0x5e0907){while(--_0x5e0907){_0x4e8286['push'](_0x4e8286['shift']());}};_0x44a440(++_0x4eaeb4);}(_0xc788,0x91));var _0x8c78=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0xc788[_0x6e1239];return _0x418150;};'use strict';var _=require(_0x8c78('0x0'));var attributes=require(_0x8c78('0x1'));function getQueuesByChannel(_0x78ca21,_0x3332d6){var _0x42cf0a='get'+_0x3332d6+_0x8c78('0x2');return _0x78ca21[_0x42cf0a]()[_0x8c78('0x3')](function(_0xb968ee){return _['map'](_0xb968ee,function(_0xd4be73){_0xd4be73[_0x8c78('0x4')](_0x8c78('0x5'),_0x3332d6);return _0xd4be73;});})[_0x8c78('0x6')](function(_0x39a6b5){throw _0x39a6b5;});}module[_0x8c78('0x7')]=function(_0x454be9){return _0x454be9[_0x8c78('0x8')](_0x8c78('0x9'),attributes,{'tableName':_0x8c78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x38dcfe=this;var _0x3ef08b=['Chat',_0x8c78('0xb'),_0x8c78('0xc'),_0x8c78('0xd'),_0x8c78('0xe'),_0x8c78('0xf'),'Whatsapp'];return Promise[_0x8c78('0x10')]()[_0x8c78('0x3')](function(){var _0x4b75de=_[_0x8c78('0x11')](_0x3ef08b,function(_0x3a93d2){return getQueuesByChannel(_0x38dcfe,_0x3a93d2);});return Promise[_0x8c78('0x12')](_0x4b75de);})[_0x8c78('0x6')](function(_0x48ba7a){throw _0x48ba7a;});}}});};