1e5c3f87c36c827a953454ba9e2d2c4cfc2f5b4e
[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 _0x5e18=['map','setDataValue','channel','catch','exports','Team','teams','Chat','Fax','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','Queues','then'];(function(_0x203a0b,_0x583c98){var _0x590daf=function(_0xe79875){while(--_0xe79875){_0x203a0b['push'](_0x203a0b['shift']());}};_0x590daf(++_0x583c98);}(_0x5e18,0xf3));var _0x85e1=function(_0x170c8b,_0x356ef8){_0x170c8b=_0x170c8b-0x0;var _0x118ab0=_0x5e18[_0x170c8b];return _0x118ab0;};'use strict';var _=require(_0x85e1('0x0'));var attributes=require(_0x85e1('0x1'));function getQueuesByChannel(_0x46c230,_0x4a75d4){var _0x4d60af='get'+_0x4a75d4+_0x85e1('0x2');return _0x46c230[_0x4d60af]()[_0x85e1('0x3')](function(_0xe31a6b){return _[_0x85e1('0x4')](_0xe31a6b,function(_0x4b3945){_0x4b3945[_0x85e1('0x5')](_0x85e1('0x6'),_0x4a75d4);return _0x4b3945;});})[_0x85e1('0x7')](function(_0x202bb6){throw _0x202bb6;});}module[_0x85e1('0x8')]=function(_0x54853f){return _0x54853f['define'](_0x85e1('0x9'),attributes,{'tableName':_0x85e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x510813=this;var _0x40004f=[_0x85e1('0xb'),_0x85e1('0xc'),'Mail',_0x85e1('0xd'),_0x85e1('0xe'),_0x85e1('0xf'),_0x85e1('0x10')];return Promise[_0x85e1('0x11')]()['then'](function(){var _0xfc4df6=_[_0x85e1('0x4')](_0x40004f,function(_0x5ab427){return getQueuesByChannel(_0x510813,_0x5ab427);});return Promise[_0x85e1('0x12')](_0xfc4df6);})[_0x85e1('0x7')](function(_0x2bb68e){throw _0x2bb68e;});}}});};