e067861319f18176cc3163b99392017c3f819a38
[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 _0xcf37=['catch','lodash','./team.attributes','get','Queues','then','map','channel','exports','define','Team','teams','Fax','Openchannel','Sms','Voice','Whatsapp','resolve','all'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xcf37,0x16a));var _0x7cf3=function(_0x513feb,_0x17635a){_0x513feb=_0x513feb-0x0;var _0x192afe=_0xcf37[_0x513feb];return _0x192afe;};'use strict';var _=require(_0x7cf3('0x0'));var attributes=require(_0x7cf3('0x1'));function getQueuesByChannel(_0x233557,_0x32d848){var _0x12953e=_0x7cf3('0x2')+_0x32d848+_0x7cf3('0x3');return _0x233557[_0x12953e]()[_0x7cf3('0x4')](function(_0x166b02){return _[_0x7cf3('0x5')](_0x166b02,function(_0x17ada3){_0x17ada3['setDataValue'](_0x7cf3('0x6'),_0x32d848);return _0x17ada3;});})['catch'](function(_0x2d71c0){throw _0x2d71c0;});}module[_0x7cf3('0x7')]=function(_0x3be841){return _0x3be841[_0x7cf3('0x8')](_0x7cf3('0x9'),attributes,{'tableName':_0x7cf3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x30c5a7=this;var _0x38f4aa=['Chat',_0x7cf3('0xb'),'Mail',_0x7cf3('0xc'),_0x7cf3('0xd'),_0x7cf3('0xe'),_0x7cf3('0xf')];return Promise[_0x7cf3('0x10')]()[_0x7cf3('0x4')](function(){var _0x38c032=_[_0x7cf3('0x5')](_0x38f4aa,function(_0x13d0ad){return getQueuesByChannel(_0x30c5a7,_0x13d0ad);});return Promise[_0x7cf3('0x11')](_0x38c032);})[_0x7cf3('0x12')](function(_0x5c9bd2){throw _0x5c9bd2;});}}});};