Built motion from commit da617fac.|2.6.6
[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 _0xf185=['Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','catch','lodash','./team.attributes','Queues','then','map','setDataValue','channel','exports','Team','Chat','Fax'];(function(_0x50bb27,_0x5715e0){var _0x237456=function(_0x7574f5){while(--_0x7574f5){_0x50bb27['push'](_0x50bb27['shift']());}};_0x237456(++_0x5715e0);}(_0xf185,0x1bd));var _0x5f18=function(_0x2b0f13,_0x49db0d){_0x2b0f13=_0x2b0f13-0x0;var _0x5e35bb=_0xf185[_0x2b0f13];return _0x5e35bb;};'use strict';var _=require(_0x5f18('0x0'));var attributes=require(_0x5f18('0x1'));function getQueuesByChannel(_0x4763e6,_0x2ce949){var _0xfb9357='get'+_0x2ce949+_0x5f18('0x2');return _0x4763e6[_0xfb9357]()[_0x5f18('0x3')](function(_0x3e5829){return _[_0x5f18('0x4')](_0x3e5829,function(_0x78715){_0x78715[_0x5f18('0x5')](_0x5f18('0x6'),_0x2ce949);return _0x78715;});})['catch'](function(_0x220a32){throw _0x220a32;});}module[_0x5f18('0x7')]=function(_0x5475e7){return _0x5475e7['define'](_0x5f18('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x2d4375=this;var _0x4f4c2a=[_0x5f18('0x9'),_0x5f18('0xa'),_0x5f18('0xb'),_0x5f18('0xc'),_0x5f18('0xd'),_0x5f18('0xe'),_0x5f18('0xf')];return Promise[_0x5f18('0x10')]()[_0x5f18('0x3')](function(){var _0x56833f=_[_0x5f18('0x4')](_0x4f4c2a,function(_0x11c1ea){return getQueuesByChannel(_0x2d4375,_0x11c1ea);});return Promise[_0x5f18('0x11')](_0x56833f);})[_0x5f18('0x12')](function(_0x330dfc){throw _0x330dfc;});}}});};