Built motion from commit d5e4af8c.|2.6.23
[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 _0x0122=['catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','resolve','then','all','lodash','./team.attributes','get','Queues','map','channel'];(function(_0x5c739f,_0x1b2ed5){var _0x5ea129=function(_0x22dda4){while(--_0x22dda4){_0x5c739f['push'](_0x5c739f['shift']());}};_0x5ea129(++_0x1b2ed5);}(_0x0122,0x1ce));var _0x2012=function(_0x8dc1a7,_0x3c2a39){_0x8dc1a7=_0x8dc1a7-0x0;var _0x4e36b9=_0x0122[_0x8dc1a7];return _0x4e36b9;};'use strict';var _=require(_0x2012('0x0'));var attributes=require(_0x2012('0x1'));function getQueuesByChannel(_0x22bf6e,_0x330454){var _0x5ab22a=_0x2012('0x2')+_0x330454+_0x2012('0x3');return _0x22bf6e[_0x5ab22a]()['then'](function(_0x16ce0e){return _[_0x2012('0x4')](_0x16ce0e,function(_0x269fe5){_0x269fe5['setDataValue'](_0x2012('0x5'),_0x330454);return _0x269fe5;});})[_0x2012('0x6')](function(_0x156975){throw _0x156975;});}module[_0x2012('0x7')]=function(_0x216f05){return _0x216f05[_0x2012('0x8')](_0x2012('0x9'),attributes,{'tableName':_0x2012('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x13ecc9=this;var _0x19e205=[_0x2012('0xb'),_0x2012('0xc'),_0x2012('0xd'),_0x2012('0xe'),'Sms','Voice','Whatsapp'];return Promise[_0x2012('0xf')]()[_0x2012('0x10')](function(){var _0x344d2c=_[_0x2012('0x4')](_0x19e205,function(_0x3eeab6){return getQueuesByChannel(_0x13ecc9,_0x3eeab6);});return Promise[_0x2012('0x11')](_0x344d2c);})['catch'](function(_0x11c3d5){throw _0x11c3d5;});}}});};